lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On 28 February 2011 17:31, Roberto Ierusalimschy <> wrote:
>> Reuben Thomas <> writes:
>> >> It's in 5.1 as well. Just not documented.
>> >
>> > Wow.
>> >
>> > No prizes for the weird format, though. What's wrong with a table?
>> This way probably saves a good 20-30 bytes of memory... :]
> Actually it is more like 500 bytes, if I did the math right (not
> counting the extra C code to create the table). Given that very few
> people use package.config, and those that use probably only need its
> first character, it does not look that cheap to me.

Nonetheless, it's unfriendly, and not consistent with the usual way in
which Lua does things. Users to whom a saving of 500 bytes is
significant have many options, including not using the package library
(which, I suggest, is likely if savings of that order are important).
The current interface invites the writing of ugly code, of incorrect
code (as with the mistake you make that only the first character of
the string will be needed by most users, when in fact you mean the
first line (the string is a newline-separated list of strings, not a
newline-separated list of characters, according to the manual)), and
of non-portable code (for users who don't even bother trying to use
this bizarre interface).