-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parser failure on argument list with trailing comma #14616
Comments
The first error ( |
The second error can be simplified to ( |
@straight-shoota , this issue not planned in the next release? Anyway, this formatter issue will cause syntax error, it should be fix ASAP. |
#6514 made this a parser error. Before that, That prompted an investigation into the syntax of newlines before a comma (aka leading comma). The result was that some languages (including Ruby) don't allow that, while others do. So it was seen as a matter of preference, and rather felt ugly. Another argument was that this wouldn't work at all for call notation without parenthesis and it would be preferred if both styles are more similar. And another point was that it simplifies the syntax of the language a little bit. Finally, other syntax features with commas such as array literals didn't allow this style either. The PR was very well received, although there were also two downvotes. Yet no critical comment was posted. |
I wouldn't mind going the other way an enable this feature. The syntax is completely unambiquous and the difference is only about the for of white space, which usually shouldn't have much influence on the meaning of a program. However, I'm also fine with keeping it as is. There hasn't been any complaint about this until now, and this only came from a misbehaviour of the formatter which introduced this syntax. |
In fact, i am okay with both case, the minimum change is preferred? consistent usage is always better. |
ping |
This code parses correctly:
bar(1, )
The following do not, with different errors (the comments are just for illustration, they are not substantial to reproduce the error).
bar(, )# Error: unterminated call
Extracted from the formatter bug issue #14609.
The text was updated successfully, but these errors were encountered: