lua-users home
lua-l archive

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


Kristofer Karlsson wrote:

Thus, I propose for the next major release, that including
"..." as the last parameter in a function definition
should be made optional, allowing you to write lua code
such as: function() return ... end

Of course, this assumes that both 1) the old style
variable argument is removed and 2) no other conflicting
changes are made to the current vararg implementation.

One such change that might be made (the Lua team can say how
likely this is) is the removal of the prohibition on using
the vararg expression as an upvalue.  Right now the
following is not allowed (it's a parse error):

 function Outer(...)
   -- A lexically nested function that accesses its
   -- containing function's varargs:
   function Inner()
     DoSomething(...)
   end
 end

If this were allowed, then omitting "..." from Inner's list
of formal parameters would need to be enough to
unambiguously mark it as a non-vararg function.

--
Aaron
http://arundelo.com