[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Thoughts on {...} and tbl[nil]
- From: Dirk Laurie <dirk.laurie@...>
- Date: Mon, 4 Jun 2018 15:39:03 +0200
2018-06-04 15:17 GMT+02:00 Roberto Ierusalimschy <roberto@inf.puc-rio.br>:
>> A change that might be possible in a minor release is to make
>> `x[nil]` mean "the length of the table literal from which `x` was
>> constructed, if still known".
>
> With the "if still known" as part of the specification, Lua already
> does that:
>
> a = {1, 2, 3}
> print(a[nil]) --> nil (meaning, "original length not known anymore" :-)
>
> That satisfies your especification, does it not?
In other words, the specification is already a valid model for Lua does :-)
The definition of "known" is a mere implementation detail.