-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Semicolons terminate statements #2665
Conversation
38d36a3
to
9a6ba03
Compare
I think the rule as written is too strong, and that the rule we want is that statements are terminated by either a semicolon or a close brace. Specifically, I don't think we want to require semicolons after I wonder if it's also worth adding something along these lines to |
Adjusted phrasing. Note now I've trimmed the abstract slightly, and shifted more to the "proposal" section (still thin, because I don't think there's that much to say).
I think https://github.com/carbon-language/carbon-lang/blob/trunk/docs/project/principles/low_context_sensitivity.md may already address this sufficiently, or put differently, maybe we could adjust that principle rather than adding another if you want it more explicitly addressed. The examples in the principle are more syntactic, but "visual aids" still has a section there and there's the up-front comment "It can be subtle: the contextual clues might be easily missed or mistaken." which could be inferred to apply to whitespace. |
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.
Generally looks good to me.
I think it'd be nice to have a slightly stronger case made for the various "optional semicolons" rules having problems and surprises, but non-essential. Comments here are generally suggesting things you could say to make that case more strongly, none seems essential to address.
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.
Thanks, this looks good to me, asking other leads...
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.
LG, thanks for writing it all up!
Statements, declarations, and definitions will terminate with either a semicolon
(
;
) or a close curly brace (}
). Semicolons are never optional.For example, with a semicolon,
x = x + 2;
. With a close curly brace,for ( ... ) { ... }
, orclass C { ...}
.This does not affect any approved proposal; rather, it makes an important
assumption explicit.
Based on lead decision #1924
Fixes #2002