lua-users home
lua-l archive

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


Andrew> 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.

There is no implicit nil beyond the last comma, by definition. It was never valid code before, so there is no breakage. What Dirk posted before as lexical void meaning nil, was a suggestion. I'm not hot for that, since I don't think it helps readability, but I wouldn't mind either if others like it. 

Luiz> ... as this simplifies code generation.

I don't know what people are autogenerating, but why wouldn't they autogenerate function calls when generating code, but only tables? I at least do the former :-) But honestly I never cared so much about that, the extra if to prepend a comma in the output loop when index is greater than 1 never was that much a hassle for me. Its more hand written code where I don't like to have failing code if forgetting to remove the trailing comma when removing what was previously the last entry.

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

Well there is only one trailing comma independently if the list was short or long. Its always one that is or isn't an issue. But I guess you mean cases where going multilined. write() is a case where it happens often, especially in luatex I experienced long argument lists with write. And there maintaining the last comma there or not there by hand is cumbersome.

Anyway, its all not too important, going to live a happy life even without trailing commas in functions :-) Just thought this would be something rather easy to fix. I also don't know of any other language that supports this, but Lua was cooler than most others anyway.