[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Request for 5.4: adding [] as table creation syntax for Lua 6.0
- From: steve donovan <steve.j.donovan@...>
- Date: Thu, 14 Jul 2016 10:31:56 +0200
On Thu, Jul 14, 2016 at 10:13 AM, Egor Skriptunoff
<egor.skriptunoff@gmail.com> wrote:
> Three reasons:
> 1) Standardization of array type in Lua (all the developers will use the
> same implementation of arrays)
> 2) Avoidance of performance penalty due to passing vararg to a function
> 3) Avoiding the limitation on number of function arguments
Valid reasons, and I like the @{...} notation. This new type (as I
understand) will be a proper array (no hash part) and will not suffer
from the hard-to-explain holes issue.
So this would be valid for all possible argument values?
function foo(...)
local args = @{...}
print(#args)
forward(...)
end
But how would this help the forwarding problem?
A new feature must provide enough power and clarity to get around the
'explanation overhead'. Otherwise, it's optimizing a special case.