[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: tables holding nil
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Wed, 22 Jul 2009 18:15:01 -0300
> It is pretty interesting that access tbl[nil] is allowed,
> while setting it is not.
Access to tbl[nil] must be allowed: otherwise "print(xxx)" would give an
error, not nil. That's the whole point of nil being the default value of
global variables and absent table entries (which are the same thing).
Setting tbl[nil] is a different matter because it probably comes from
a programmer error. On the other hand, a case can be made for allowing
it and then return that value when accessing tbl[nil]. So the default
behavior would correspond to tbl[nil]=nil.