[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Making luaconf.h settings available in Lua
- From: Reuben Thomas <rrt@...>
- Date: Mon, 28 Feb 2011 20:27:27 +0000
On 28 February 2011 20:03, Kevin Vermeer <reemrevnivek@gmail.com> wrote:
> On Mon, Feb 28, 2011 at 2:42 PM, Reuben Thomas <rrt@sc3d.org> wrote:
>>
>> On 28 February 2011 19:34, Kevin Vermeer <reemrevnivek@gmail.com> wrote:
>> >
>> > Thanks for sweating these details. I understand that many of your users
>> > may
>> > never go outside of the infinite memory model popular in desktop
>> > programming, but some of us embedded programmers are trying to use Lua
>> > with
>> > 64kB or less of RAM, so those 500 bytes make a big difference!
>>
>> So when you're using Lua in 64Kb of RAM, you still use the package
>> library? Why?
>>
>
> For the same reasons you use it on whatever machine you have.
So, when you only have 64Kb of memory at your disposal, you have
complicated enough programs that it's worth spending several kB on the
module system? (Stripped, loadlib.o is 5.8Kb on my machine, which
suggests that you're using 10% of your memory (allowing conservatively
for run-time memory usage) just to keep track of the modules you load
into the rest. I must be missing something?
> I could ask you why you don't just use your stdlib library on your system,
I do, but that only helps people who use stdlib.
> This doesn't seem to
> be unfriendly, ugly, or bizarre as you claim it is.
Clearly it is, or I wouldn't have to write the veneer.
> It might be a little inconsistent, but, as Roberto argued, that's a sacrifice that's probably
> acceptable.
No, it's not acceptable, because it doesn't help anyone. Those of us
who have plenty of memory are not well-served by the weird interface
which needs programming around to use in programs (and even Roberto
got it wrong). Those of us who are memory-constrained don't need
loadlib in the first place, and so aren't helped by the memory saved.
> The real issue is that if the language designers chose to spend the 500
> bytes every time the question came up, Lua would soon become as big as
> Python.
Every time what question came up? This is not another little extra of
the sort frequently discussed, whose accumulation soon makes the
language bigger. This is a feature which already exists, but whose
implementation is badly designed.
> Lua's small size is a more important than the table/string nature of
> package.config, and not just to embedded developers.
Lua's small size is important, but not at the expense of its
simplicity. It's a balance that the design mostly gets right. There
are other details from luaconf.h it would be nice to make accessible
in Lua, such as LUAL_BUFFERSIZE, LUA_NUMBER_FMT, LUA_NUMBER_SCAN,
LUAI_MAX_NUMBER2STR and so on. There are various ways in which this
could be done, but shoving them all in a long string is not a good
one. The obvious thing to do would be to add similar constants to the
relevant libraries (or _G, for non-library-specific values). It's
consistent and extensible. It will use a few hundred more bytes too,
but that's just the nature of Lua's data structures: one can equally
save hundreds of bytes by removing any other features one doesn't use.
--
http://rrt.sc3d.org
- References:
- Making luaconf.h settings available in Lua, Reuben Thomas
- Re: Making luaconf.h settings available in Lua, Petite Abeille
- Re: Making luaconf.h settings available in Lua, Reuben Thomas
- Re: Making luaconf.h settings available in Lua, Petite Abeille
- Re: Making luaconf.h settings available in Lua, Reuben Thomas
- Re: Making luaconf.h settings available in Lua, Miles Bader
- Re: Making luaconf.h settings available in Lua, Roberto Ierusalimschy
- Re: Making luaconf.h settings available in Lua, Kevin Vermeer
- Re: Making luaconf.h settings available in Lua, Reuben Thomas
- Re: Making luaconf.h settings available in Lua, Kevin Vermeer