lua-users home
lua-l archive

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


I fact this suppression of commas is a vary bad idea: instead of attempting to remove commas conditionally, it's highly preferable to use the comma always, even at end of a comma-separated list: Lua already supports the last comma not followed by any _expression_ and not followed by another comma, as being ignorable).
So for tables of functions, in source code coming from code generators, just terminate all of them with a comma and you are safe. We never need to drop these commas and introduce new parsing ambiguities.

Also the idea if special meanings to "any whitespace" is very bad (_javascript_ does not tolerate it, it gives special meaning ONLY to sequence of whitespaces/comments containing at least one newline as a possible statement terminator, i.e. treated like a ";", in specific parts of the syntax; unfortunately this is not true for Lua that treats ALL sequences of whitespaces, possibly including comments, as a token separator without any syntaxic role, and then the Lua parser has to disambiguate statement termination when this could be continued in the next line or the same line for "currified" function calls). currified expressions should have never been allowed in Lua, except inside parentheses or in comma-separated lists, for function call parameters or table initializers.

But adding new similar ambiguities for the commas (like for the semicolon) by making them optional would be even worse, with dramatic unpredicable effects for code generators and code parsers!

Le sam. 17 août 2019 à 17:35, szbnwer@gmail.com <szbnwer@gmail.com> a écrit :
hi Jim! :)

> i do not like the idea of giving special meaning to newlines
(often abused as statement terminators) or any other whitespace token.

sure thing! :) otoh we can miraculously live with _javascript_ and the
world is not burning in flames because its terminators, but cuz
everything else :D

https://www.dropbox.com/s/j98f8p79fkb9l8a/pontosvessz%C5%91.png
it says "this semicolon is misplaced" (sorry for dropbox, imgur wanted
me to register or i missed the right way)

bests! :)