[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Nils in tables in Lua 5.4.0 (worki1) (Was: [ANN] ...now available
- From: Roberto Ierusalimschy <roberto@...>
- Date: Thu, 15 Mar 2018 15:59:16 -0300
> I do value a lot the possibility of being able to keep writing code
> that's "5.1 and up" compatible (LuaRocks is like that!). But I'd
> prefer to have a syntax that doesn't work at all on 5.1-5.3 than to
> have 5.4 code that runs on 5.3 (and vice-versa) but then silently
> behaves differently.
I don't see how 't[i]=undef' would behave differently with the new or
the old semantics. What will behave differently is 't[i]=nil' (after
all, this is the whole point of the change in the behavior), which
we should avoid.
> [...] if anywhere you forget and "unset" a key with nil (which you
> can do indirectly, e.g. with table.move(), so no, grepping the sources
> isn't enough), [...]
Just for curiosity, can you give me a real-case example of unseting a
key with nil indirectly through table.move?
-- Roberto