-
Notifications
You must be signed in to change notification settings - Fork 501
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
Updated section on identifiers for raw identifiers #395
Conversation
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.
A couple nits, but otherwise good.
src/identifiers.md
Outdated
|
||
An identifier is any nonempty ASCII string of the following form: | ||
A normal (non-raw) identifier is any nonempty ASCII string of the following form: |
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.
I don't think this line needs to change. I feel like it draws attention away from basic identifiers in a way that could be confusing.
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.
Yeah, I thought about this... you definitely have a point. I just wasn't sure if it would be misleading to "go back" on the initial definition of an identifier slightly. But fair enough.
src/identifiers.md
Outdated
@@ -21,5 +23,7 @@ Or | |||
* The identifier is more than one character. `_` alone is not an identifier. | |||
* The remaining characters are alphanumeric or `_`. | |||
|
|||
A raw identifier is like a normal identifier, but prefixed by `r#`, which is not included as part of the identifier. Unlike a normal identifier, a raw identifier may be any strict or reserved keyword. |
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.
Nit: Comma splice. Trade the last ,
for a .
and replace which
with The `r#`
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.
Hmm I think you misread perhaps? It wouldn't make sense like that grammatically.
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.
A raw identifier is like a normal identifier, but prefixed by `r#`. The `r#` is not included as part of the identifier.
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.
I'm not sure that improves clarity, but if you really want, I'll do it. 😉
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.
Actually, looking at it closer, another option is to change ", but" to "except". So A raw identifier is like a normal identifier except prefixed by `r#`, which is not included as part of the identifier.
The main thing is to get rid of one of the commas as it's currently grammatically murky with both of them.
src/identifiers.md
Outdated
@@ -21,5 +23,7 @@ Or | |||
* The identifier is more than one character. `_` alone is not an identifier. | |||
* The remaining characters are alphanumeric or `_`. | |||
|
|||
A raw identifier is like a normal identifier, but prefixed by `r#`, which is not included as part of the identifier. Unlike a normal identifier, a raw identifier may be any strict or reserved keyword. |
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.
"...any strict or reserved keyword" except crate
, extern
, self
, Self
or super
.
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.
Okay, I thought there might be exceptions, thanks.
eff3ac6
to
f033a4e
Compare
…mertj Stabilise raw_identifiers feature * [Reference PR](rust-lang/reference#395) * [Book PR](rust-lang/book#1480) * [Rust by Example PR](rust-lang/rust-by-example#1095) Closes rust-lang#48589. r? @cramertj CC @cuviper @Centril
The grammar is technically okay as-is, but if it made you misread it, then it could plainly be clearer! I don’t want to confuse others after all. I think I’ll go with your first suggestion if that’s alright. (You still need the comma after “identifier” in your second suggestion.)
… On 11 Aug 2018, at 21:30, Ryan Scheel ***@***.***> wrote:
@Havvy commented on this pull request.
In src/identifiers.md <#395 (comment)>:
> @@ -21,5 +23,7 @@ Or
* The identifier is more than one character. `_` alone is not an identifier.
* The remaining characters are alphanumeric or `_`.
+A raw identifier is like a normal identifier, but prefixed by `r#`, which is not included as part of the identifier. Unlike a normal identifier, a raw identifier may be any strict or reserved keyword.
Actually, looking at it closer, another option is to change ", but" to "except". So A raw identifier is like a normal identifier except prefixed by `r#`, which is not included as part of the identifier. The main thing is to get rid of one of the commas as it's currently grammatically murky with both of them.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <#395 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AAEF3EkGKgwiYnjxGFJaMsXeq-BXmXRvks5uPz7cgaJpZM4V2yNI>.
|
f033a4e
to
25227b4
Compare
…mertj Stabilise raw_identifiers feature * [Reference PR](rust-lang/reference#395) * [Book PR](rust-lang/book#1480) * [Rust by Example PR](rust-lang/rust-by-example#1095) Closes rust-lang#48589. r? @cramertj CC @cuviper @Centril
Stabilise raw_identifiers feature * [Reference PR](rust-lang/reference#395) * [Book PR](rust-lang/book#1480) * [Rust by Example PR](rust-lang/rust-by-example#1095) Closes #48589. r? @cramertj CC @cuviper @Centril
Can we get this merged now that the actual Rust feature has been stabilised? :-) |
Yes. 💟 Thanks for the contribution! |
No description provided.