[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Holes
- From: James Graves <ansible@...>
- Date: Thu, 16 Dec 2010 16:34:25 -0600
Dirk Laurie wrote:
> 2. All these brilliant suggestions can be implemented totally within
> Lua itself without changing the specification of the language.
Indeed. The behavior of the table length operator has bothered me in the
past. However, I've since come to be in total agreement with Renato
Maia's view. Meaning that, if you want holes in your list, then what
you really want is not a regular Lua table, but a new data structure
(that uses a table for storage). As the discussion has shown, there are
different ideas for the what the length of the list really means in the
presence of holes. And those different views can, and should be
reflected in the new data structure's implementation.
As a side note, I do sometimes use a table as a regular list, but then
stash extra stuff under named keys. So if the table length operator
included items in the hash part... well, that would be bad for me.
So I'm fine with how the table length operator works as it is right now.
James Graves