lua-users home
lua-l archive

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



On Jul 1, 2013, at 12:05 PM, Coda Highland <chighland@gmail.com> wrote:

Under this proposal, nils are no longer holes.

That could be useful, but also a bit confusing as it means a key set to nil
and a key that was never set (or was deleted) are different things, but both
have a nil value.

You can tell the difference with table.has().

Depending on how # behaved, you might also be able to tell with just (i <= #t) ?

I find this whole idea interesting, though it does make the meaning of nil more confusing in a table. I suspect the end-game for this model is declarative array sizes .. not sure what I think of this, as that does look more like just using a private "n" stored in the table somewhere.

--Tim