lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


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.