Updated section on identifiers for raw identifiers#395
Updated section on identifiers for raw identifiers#395Havvy merged 1 commit intorust-lang:masterfrom
Conversation
Havvy
left a comment
There was a problem hiding this comment.
A couple nits, but otherwise good.
| > IDENTIFIER_OR_KEYWORD <sub>*Except a [strict] or [reserved] keyword*</sub> | RAW_IDENTIFIER | ||
|
|
||
| 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.
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.
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.
| * 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.
Nit: Comma splice. Trade the last , for a . and replace which with The `r#`
There was a problem hiding this comment.
Hmm I think you misread perhaps? It wouldn't make sense like that grammatically.
There was a problem hiding this comment.
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.
I'm not sure that improves clarity, but if you really want, I'll do it. 😉
There was a problem hiding this comment.
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.
| * 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.
"...any strict or reserved keyword" except crate, extern, self, Self or super.
There was a problem hiding this comment.
Okay, I thought there might be exceptions, thanks.
…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>.
|
…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.