-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Ambiguous syntax with operator suffixes #28441
Comments
To be clear, it is only the letter sub/superscripts that are the problem here; the other operator suffixes are not allowed as the first character of an identifier. |
This is another case similar to |
They're kind of weird as the first character in an identifier. At least in my mind |
See also #20278 … identifiers starting with superscripts/subscripts aren't that common, but do appear occasionally in mathematics. It wouldn't be a huge loss to lose them in Julia, though, I guess. |
We wouldn't necessarily lose them, we would just lose the ability to write |
This updates the documentation in line with the proposal in JuliaLang#28441 to disallow `+ᵃx` Ideally, the parser should be updated together with the documentation, but I'm not familiar enough with the parser internals to do that myself. This is a breaking change, since `+ᵃx` is currently legal syntax. (The way I interpret semantic versioning, the breaking change occurs when the documentation is updated. If the parser is later updated to work in accordance with the documentation, then that would technically be a bugfix, and wouldn't have to wait until the next major release. In practice though, people will be upset if code that was working in 1.0 suddenly stops working in 1.x.)
* Documentation of amiguous syntax, operator suffix This updates the documentation in line with the proposal in #28441 to disallow `+ᵃx` Ideally, the parser should be updated together with the documentation, but I'm not familiar enough with the parser internals to do that myself. This is a breaking change, since `+ᵃx` is currently legal syntax. (The way I interpret semantic versioning, the breaking change occurs when the documentation is updated. If the parser is later updated to work in accordance with the documentation, then that would technically be a bugfix, and wouldn't have to wait until the next major release. In practice though, people will be upset if code that was working in 1.0 suddenly stops working in 1.x.) * fix whitespace Co-authored-by: Kristoffer Carlsson <[email protected]>
* Documentation of amiguous syntax, operator suffix This updates the documentation in line with the proposal in JuliaLang#28441 to disallow `+ᵃx` Ideally, the parser should be updated together with the documentation, but I'm not familiar enough with the parser internals to do that myself. This is a breaking change, since `+ᵃx` is currently legal syntax. (The way I interpret semantic versioning, the breaking change occurs when the documentation is updated. If the parser is later updated to work in accordance with the documentation, then that would technically be a bugfix, and wouldn't have to wait until the next major release. In practice though, people will be upset if code that was working in 1.0 suddenly stops working in 1.x.) * fix whitespace Co-authored-by: Kristoffer Carlsson <[email protected]>
In Julia 0.6, the following is legal syntax:
But after #22089, it errors with "UndefVarError: +ᵃ not defined", because it parses as
1 +ᵃ x
.One possible remedy would be to deprecate variable names that begin with characters that are allowed as operator suffixes.
Another option would be to require spaces around suffixed operators.
Or do both, with the options of removing the spaces requirement in a later version.
The text was updated successfully, but these errors were encountered: