-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Name starting with non-ascii uppercase letter is not treated as constant #12791
Comments
treat names starting with any uppercase letter as constant not only ascii uppercase letters (A-Z) for example Á (Latin Capital Letter A with Acute) Fixes crystal-lang#12791
This might have been discussed somewhere before, but I'm not sure. Uppercase first-character indicates a constant and it's a very relevant distinction from a lowercase variable. That means the two cases need to be easily discernible. There might be some trouble with that when following the Unicode character classes. That being said, I think it's generally a good idea to allow using non-ASCII characters in identifiers the same way as ASCII characters. The above example with class |
The same can also be said about titlecase characters, i.e. Ruby also treats identifiers starting with titlecase characters as constants rather than variables. |
…and titlecase. Fixes crystal-lang#12791
…and titlecase. Fixes crystal-lang#12791
The following code does not compile:
Some corner cases to narrow the problem:
Á
failsA
worksAőű
worksAőűŐű
also worksWhen a name starts with non-ascii uppercase letter (for example
Á
) it is currently not treated as constant.This bevaviour also causes a bug:
Running on Ubuntu 21.10:
The text was updated successfully, but these errors were encountered: