-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Support unicode superscripts #26522
Support unicode superscripts #26522
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @nikomatsakis (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. The way Github handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
let σ⁶ = 2; | ||
let σ⁷ = 2; | ||
let σ⁸ = 2; | ||
let σ⁹ = 2; |
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.
Maybe also test let σ⁴² = 2;
I'm not in favor. Get the Unicode Consortium to extend XID_continue, let's not deviate from them ad-hoc. |
(Note also that I believe extending the surface syntax in this way would require an RFC.) |
-1 to this random extension. |
Given that unicode identifiers are still behind a feature flag, I don't think so. There would be one to stabilize it, of course... |
Alternatively, we could accept all characters from Letter,Modifier and Number,Other categories as non-first identifier character. This is what Haskell does. |
Given the controversy of this and the fact that this is a somewhat major language change, this should probably be an rfc. |
Hmm. This has historically been an area with a (somewhat) surprising amount of controversy. I am not persuaded that we have to block on the Unicode consortium, but it is nice to follow existing precedent. Have other languages deviated from |
Many thanks to the author of this PR, but I am inclined not to accept it. I think instead someone should write-up an RFC describing a coherent policy, which we should then implement and stabilize. Speaking personally, I think that an RFC that can argue from some precedent (C++, Haskell, etc) will be much stronger than what which carves out a new space of identifiers, regardless of how good that space is (I am unclear whether this PR is carving out a new space or not, so I'm not implying anything about this PR per se). UPDATE: Edited to remove somewhat unfortunate phrasing. |
FWIW -- I'd love to be able to use unicode superscripts :) |
Currently Rust allows unicode subscripts to continue identifiers; I've added support for superscripts as well.
See below for discussions:
#4928
https://users.rust-lang.org/t/allow-unicode-superscripts-in-identifiers/1892
r? @nikomatsakis