lua-users home
lua-l archive

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

On Jun 10, 2014 6:10 AM, "Axel Kittenberger" <> wrote:
>> I'm happy with the table constructor allowing an extra delimiter precisely
>> because {a,b,c}, {a,b,c,} and {a,b,c,nil} all do the same thing, and I am
>> not happy with the original proposal because for f(...), the difference
>> between f(a,b,c) and f(a,b,c,nil) can be detected by select('#',...).
> This is a strawman you created yourself you are now tearing down. There is not implicit nil [...] in the proposal

No, but what if there were? It's very Lua that nil and tables perfectly fit together in a way you don't have to remember which way the language design went for trailing comma. You can have either mental model, even if one is incorrect.

Trailing comma is a very traumatic subject for many of us, because _javascript_ does the wrong thing. Switching between languages, I forget semicolons too. The C compiler catches that case, at least...

Anyway, given how often I screw up with f(a, b, c, g()) where g returns multiple values, I'm not sure trailing nil would hurt me much.