-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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: Simplify attribute syntax #11141
Comments
Closing as a dupe of #2569. There has been a very large amount of discussion in that other bug, and I believe the settled-upon syntax was:
And we would no longer attributes at the outer layer of the form |
2013/12/26 Gábor Lehel [email protected]
+1, this is better and simpler |
Oh, for some reason I hadn't remembered #2569 also talked about dropping the brackets. Sorry! |
…st-lang#14124) An `if … { … } else { … }` used as the left operand of a binary expression requires parentheses to be parsed as an expression. Fix rust-lang#11141 changelog: [`obfuscated_if_else`]: fix bug in suggestion by issuing required parentheses around the left side of a binary expression
Instead of
write
in other words, instead of a list of attributes delimited by
[]
,#
would introduce a single attribute, and multiple attributes would be written as multiple single attributes.This is less busy visually, especially when there's only one attribute, which is common. In terms of character count it requires 1 character for a single attribute (vs. 3 with the current syntax), and 2 additional characters for each additional attribute (same as the current syntax).
And it looks like hashtags, which is cute and not a bad intuition.
I don't know why the syntax is the way it is right now: historically, I think it's probably because macros were originally
#foo()
rather thanfoo!()
? But I don't see any other potential for conflict in today's syntax. (The only other place the#
character is even used, as far as I know, is raw strings.)The text was updated successfully, but these errors were encountered: