Skip to content
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

Rust doesn't support x₁ and x₂ identifiers while C++ does. #3402

Open
VorfeedCanal opened this issue Mar 19, 2023 · 7 comments
Open

Rust doesn't support x₁ and x₂ identifiers while C++ does. #3402

VorfeedCanal opened this issue Mar 19, 2023 · 7 comments
Labels
T-lang Relevant to the language team, which will review and decide on the RFC.

Comments

@VorfeedCanal
Copy link

Most C++ compilers supported x₁ and x₂ as valid identifiers since addition of Unicode support: https://godbolt.org/z/zhGzTKjeK

Clang dropped that support in version 14 but it was restored in version 16 when “Mathematical notation profile for default identiers” ( https://www.unicode.org/L2/L2022/22230-math-profile.pdf ) was adopted.

Would it make sense for Rust to adopt it, too?

@thomcc thomcc added the T-lang Relevant to the language team, which will review and decide on the RFC. label Mar 19, 2023
@thomcc
Copy link
Member

thomcc commented Mar 19, 2023

CC @Manishearth

@Manishearth
Copy link
Member

That's not spec yet, I'm waiting for the new UAX 31 to be out to propose this.

(the new source code spec will also be something we should look at)

There's similar work we may want to do to support ZW(N)J.

@Manishearth
Copy link
Member

If someone wants to propose an RFC for this based on the draft UAX 31 spec I'm happy to help them with it, I don't have time to do it myself

@jyn514 jyn514 transferred this issue from rust-lang/rust Mar 25, 2023
@thomcc
Copy link
Member

thomcc commented Mar 25, 2023

How likely are things to change from the draft before finalization? Is it worth waiting for the UAX31 update to exit draft status?

@Manishearth
Copy link
Member

Unlikely, I think.

@Aloso
Copy link

Aloso commented Jul 19, 2023

I don't think an RFC is necessary for this. The non-ascii-idents RFC says that Rust follows the UAX 31 spec. So when the UAX 31 spec is updated, Rust's parser should be updated accordingly. Or am I missing something?

@Manishearth
Copy link
Member

No, because these are not a part of the default identifier profile specced in UAX 31: they are an additional profile that the spec lists which users of the spec can choose to follow instead. We have to explicitly make that choice.

When Unicode releases a new version we are absolutely allowed to update our UAX 31 data without an RFC, but this changes the algorithm we are choosing to use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-lang Relevant to the language team, which will review and decide on the RFC.
Projects
None yet
Development

No branches or pull requests

4 participants