[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] Lua 5.2.0 (alpha) now available
- From: Enrico Colombini <erix@...>
- Date: Sun, 12 Dec 2010 13:03:17 +0100
A minimalist crazy idea: perhaps, just to avoid surprises and offer a
predictable behavior to Lua beginners, #t could return nil if the list
has holes (i.e. it's not a proper array).
That should be cheap to implement, at least for one-way behavior: once a
hole in introduced (i.e. a non-nil assignment is made outside the range
[1..#t+1], or a nil assigment is made inside [1..#t-1]) #t would stay
nil forever even if the hole is later filled. It would probably cost too
much to detect if all holes are re-filled.
I'm not sure if the that behavior could create trouble in normal usage,
though (e.g. because of a temporary nil assignment inside the array).
--
Enrico