Rationale behind excluding some unicode characters from identifiers

I’m wondering why some Unicode punctuation characters (Open Punctuation Ps, and Close Punctuation Pe) were excluded from variables names (identifiers) in this PR.

julia> ❘u❘ = abs(u)  # allowed, e.g. denote an absolute value
julia> ⟦u⟧ = 1  # why not ? my use case is denoting a jump
ERROR: syntax: invalid character "⟦" near column 1
julia> ⦃u⦄ = 1  # why not ? my use case is denoting an average
ERROR: syntax: invalid character "⦃" near column 1

one or more of the following:

  • too subtle
  • too confusing
  • too obscure (user may not know what the heck this symbol means or called or how to type it, sure, can use Julia REPL, but com’on)
2 Likes

The slightly more detailed answer is that the parser needs to know whether a character is part of a name or if it is an operator. (e.g. you can’t name a variable a⊂). As such we only add Unicode characters on request.

8 Likes

That’s not my question. There are a lot of other Unicode characters that lead to ambiguities and still allowed (difficult to distinguish because of the current font, close to another: it’s the responsibility of the developer to use them sparingly), but I’m interested in knowing why these specific characters were excluded.

Thanks, so they might be reserved for future operator usage (conservative choice).
So what would be the criterion for such a request to be accepted ?

If they’re added on requests, request it: if it is rejected, you’ll know why!

6 Likes

yeah. Just open an issue and if there aren’t problems someone will probably add them to the list.

I want to use various fancy brackets as constructors for fancy container objects, so I wouldn’t want them to be in identifiers, just like [](){} aren’t in identifiers.

1 Like

Do you have an example ?

For example, if I could define

⦃1,2,2,3⦄ == MultiSet([1,2,2,3])

I’ve opened [FR] Allow more Unicode characters from `Ps` and `Pe` categories for identifiers · Issue #48885 · JuliaLang/julia · GitHub and Allow more Unicode characters from `Ps` and `Pe` categories for identifiers by t-bltg · Pull Request #48886 · JuliaLang/julia · GitHub, to be discussed.