-
-
Notifications
You must be signed in to change notification settings - Fork 161
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
[RFC 0118] Extra semicolon as a warning instead of an syntax error #118
Conversation
Signed-off-by: lucasew <[email protected]>
Signed-off-by: lucasew <[email protected]>
I oppose changing (complicating) the language for the sake of a bit easier programming. Also, it is slippery road, and can cause semicolon mess as in JavaScript (it has obscure rules when newline is interpreted as semicolon). Any decent editor is capable of pre-save hooks, and something as simple as |
Yes semicolons are just used with attribute sets, |
The RFC is open for shepherd nominations now |
Nominations are still open, if anyone would like to move this RFC forward this would be welcome. |
I nominate myself as a shepherd for this RFC (full disclosure: I'm not keen on this RFC passing, but aim to take the role of shepherd seriously and don't intend to "veto" or anything). |
Since we only have one shepherd nomination at this time, we've decided to convert this RFC to draft status. If people are interested in shepherding, please let us know and we can un-draft it! |
# Detailed design | ||
[design]: #detailed-design | ||
|
||
Allow an optional semicolon at the end of an expression raising a warning if it's provided. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not a detailed design.
I would expect to get a good idea of how this will be implemented technically.
Note that I tried adding an optional semicolon to the parser a few years ago, but it was rejected because my implementation was naïve (just have a giant lookahead essentially). So I’d like to see a technical design here that is feasible.
=> 2+2 | ||
4 | ||
=> 2+2; | ||
warning: extra semicolon at the end of the expression |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For files, it should also show which file is having the extra semicolon.
There are no alternatives so far. | ||
|
||
The impact of not doing this is not critic. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One alternative is changing the error from:
error: syntax error, unexpected ';', expecting end of file
to something like:
error: syntax error, unexpected ';', expecting end of file
Consider removing the ';' at the end of the file or expression.
at «string»:1:4:
1| 1+2;
| ^
That said, allowing people to write ;
, but outputting a warning might cause warnings in places when the parser touches a file lazily. Potentially warning about extraneous ;
in files that I didn't write myself.
I think this RFC should be closed since almost all people don't think this is a good idea. |
This RFC is being closed due to lack interest. If enough shepherds are found this issue can be reopened. If you don't have permission to reopen please open an issue for the NixOS RFC Steering Committee linking to this PR. |
Local code flow can leave a semicolon at the end of the file and this should be a warning instead of an error.
Rendered