lua-users home
lua-l archive

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

On Mon, Jul 1, 2013 at 1:04 PM, Roberto Ierusalimschy
<> wrote:
>> Couldn't a lot of ambiguity and unexpected behavior avoided by keeping
>> nil but introducing two new functions to the table library called
>> "table.has(t,key)" and "table.delete(t,key,[to])" - and dropping the
>> deletion via assigning nil?
> At last something new and worth a discussion. Does anyone see problems/
> incompatibilities/etc. with this?

I'm not sure i would like this better than the current behavior or
not, but it's a _very_ different behavior.

in fact, this feels a little like Python's dictionaries.  i don't mean
that every difference between Python and Lua is automatically a win
for Lua and lose for Python, but such change would certainly make Lua
a lot closer to Python than where it is today.

also, i guess this would have massive incompatibilities, unless it's
an optional behavior....  maybe a "sticky" flag in the metatable (akin
to the 'weak' flags), meaning that key/value pairs stick around until
you explicitly remove them...