lua-users home
lua-l archive

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





On Wed, Jun 4, 2014 at 11:15 AM, Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br> wrote:
> However, I never understood, why trailing commas are not allowed in
> function calls.

One argument for not supporting this is that argument lists are almost never
generated automatically, which was the original motivation for supporting
trailing commas in table constructors, as this simplifies code generation.

Another is that argument lists in practice are never very long.


Tables don't store nil values, so there is no ambiguity there.

With argument lists, it would be ambiguous as to whether or not a nil was being placed there and that is not the same thing.

local function foo(...)
   return select("#", ...)
end

assert( foo() < foo(nil))

-Andrew