[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Thoughts on {...} and tbl[nil]
- From: dyngeccetor8 <dyngeccetor8@...>
- Date: Sat, 2 Jun 2018 15:43:44 +0300
On 06/02/2018 09:06 AM, Dirk Laurie wrote:
> 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".
I appreciate idea to have ability to get "syntactical" length of
table literal.
Just don't like (<name> "[" "nil" "]") syntax.
It's not obvious. Literal "nil" contradicts common sense (in my view)
that "v = t[nil]" is equivalent to "k = nil; v = t[k]". It exploits
sole value (nil) that can not be used as a key.
I understand that another approach - add global metatable with border
management methods to any table, will introduce another set of problems.
Like name clashing and some performance drop due overhead. But I'd
prefer it anyway.
-- Martin