Skip to content

Variable named ∇x gives "unknown start of token" compiler error #120142

Open
@Danvil

Description

I tried this code:

let ∇x = 1;

I expected the code to compiles but instead I get the compiler error message "unknown start of token \u{2207}".

This is surprising as variable names starting with Greek letters are fine:

let Δλ = 1;

I believe the cause is that Rust identifiers need to start with a XID_Start unicode characters, however the "Nabla" ∇ (0x2207) does not seem to be on that list.

It would be great to have the "Nabla" operator as a valid start token for identifier as it very commonly used in physics and mathematics to denote the derivative of a multi-variable function.

A possible workaround is to use the "Canadian syllabics e" ᐁ (0x1401).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-UnicodeArea: UnicodeC-enhancementCategory: An issue proposing an enhancement or a PR with one.T-langRelevant to the language team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions