lua-users home
lua-l archive

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

Non relevant. The presence of absence of trailing commas on comma-separated lists of values have NO influence on curryfication. These lists are always enclosed by other signs.
We are not asking at removing commas between items, just allow a trailing comma at end of lists (never followed by anything that could be part of function calls, such as an opening parentheses for starting an explicit list of call parameters, or another value that could be currified).
The ambiguity of currification in Lua does not occur with commas but with semicolons that are optional everywhere between statements (where the missing semicolon is the implied by a newline.
Thanks other languages do not have this almbiguity, notably _javascript_ (which also allows optional commas at end of lists, and allows dropping the semicolon before a closing brace, or a keyword like "else", "until". _javascript_ is the perfect example of how the Lua syntax should behave, while keeping curryfication, and always treating newlines as optional and accepted anywhere there can be whitespace separators between tokens). The behavior of Lua just complexifies the parsing and causes lot of issues that do not exist with the Javacript syntax (Lua just uses begin/end instead of braces but that's not a relevant difference here).

Le lun. 6 mars 2023 à 07:02, Frank Mitchell <> a écrit :
On Sunday, March 5, 2023 at 01:48:36 PM CST, Jorge Visca <> wrote:
> For another language, perhaps functions should allow a single parameter.

One could always do what Haskell(?) does and use currying. A function takes one parameter that returns a function that takes another parameter ... and so on until the last function produces an actual result.

But I vote we leave Lua as it is.  If some actual end-users have tripped over the presence or absence of commas, I'd be willing to change my opinion ... for whatever that's worth.

Frank Mitchell