lua-users home
lua-l archive

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


2018-05-29 20:32 GMT+02:00 Russell Haley <russ.haley@gmail.com>:
>
>
> On Tue, May 29, 2018 at 9:53 AM, Roberto Ierusalimschy
> <roberto@inf.puc-rio.br> wrote:
>>
>> >      Just musings, but... I hope they get in, and I hope that
>> > `lua_keyin`
>> > as well as the potential hypothetical `lua_keyvalue` include versions
>> > that
>> > get integers and fields for number / string arguments directly (as well
>> > as
>> > their raw version), making for a full suite that allows maximum
>> > performance
>> > and mimics the current Lua C API structure:
>> >
>> >      [...]
>>
>> We have decided that, at least for 5.4, we are not going on with
>> the nils-in-table proposal. Although we really like the idea, the
>> compatibility problems seem too big. As this message evidentiates again,
>> the language would need a lot of extra stuff (metamethods, API calls,
>> etc.), even when the option is off.
>>
>> -- Roberto
>>
> : - (
>
> That's too bad.  The behavior of holes in tables was a huge block for me
> when I started using Lua (and is still a pain in the ass IMO). I think
> allowing nil in tables removes a hole in the language (pun intended) and
> makes tables jmore friendly for newcomers and more practical for using as a
> sequence. Are we going to have to wait another 4 years for you to tease us
> with the possibility again?
>
> This is very disappointing news. (To be clear, the news disappoints me, not
> the people or the language. No flaming necessary).

Nils in tables will be very counterintuitive for people who for
several years have used mainly Lua. (It may be OK for some people
still used to what their previous language did.)

Some years ago, I had this bright idea. Self-initializing tables. The
first time you access tbl[i], the __index metamethod would kick in and
construct the object. Items you never access need never be
initialized. Brilliant.

Until a table in which I had initialized everything was used in `for
k,v in ipairs(tbl) do`. Work out what happened. It was painful.