-
-
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
\Bbbone
is not valid input
#10762
Comments
I see that |
Same with |
There's a place in the parser that checks if a character is valid to place at the beginning of an identifier name. |
OK, I see, thanks. Maybe these symbols could be included as allowed? |
Does this mean that it might be possible to do |
Well, 𝟙 is quite commonly used for the identity matrix or the matrix of all ones. Being able to use it as a variable name is a valid use case. |
Having to squint to determine whether |
"Get a better font" :) |
AWESOME. :) I don't really have a large dog in this fight: I can't imagine ever using this but I recall the security / phishing problems we had when unicode characters were allowed in URLs, and I imagine something similar can happen in Julia. It was a bad idea for URLs, and it seems like some of the same problems might be carried over here. I can't wait to try this out though. |
I don't think we should conflate this issue with #9744. |
This character is numberlike and so is not allowed to start an identifer. However we don't parse it as a number either, hence the current error. I think this situation is reasonable. You tend not to see fonts using "1" for "𝟙" (has anybody seen this?); you usually get a reasonable glyph or else some nasty replacement character. I don't think it's the place of a programming language to try to ban characters. I acknowledge the security problems caused by unicode in URLs, but I find it circuitous logic to say that unicode should be disallowed in hopes of slightly decreasing the surface area for phishing attacks. |
- Mathematical bold 0, 1 (U+1D7CE, U+1D7CF) - Mathematical double-struck 0, 1 (U+1D7D8, U+1D7D9) which are sometimes used to represent certain representations of additive and multiplicative identities. Closes #10762
- Mathematical bold 0, 1 (U+1D7CE, U+1D7CF) - Mathematical double-struck 0, 1 (U+1D7D8, U+1D7D9) which are sometimes used to represent certain representations of additive and multiplicative identities. Closes #10762
That's not what I was suggesting - sorry for any misunderstanding. I think that the current approach (as I understand it) of not allowing "numberlike" characters to start identifiers is the correct one. ... but I see that a commit has already been made to allow this. I'll just go once more on the record that I think it's a bad idea, and will move on. |
The proposed change was not merged; seems this was decided against. |
The other discussion seems to have gotten rather distracted, so I'm not sure it was ever really resolved. FWIW, I would still be in favour of allowing these, as well as the various vulgar fractions ( |
@simonbyrne just to clarify (and to refresh my memory) - is it your suggestion that the vulgar fractions would be "numberlike" in that they wouldn't be allowed to be (or to start) variable names? |
Actually I'm not sure: I was just throwing them into the mix as they could be useful, but currently get parsed as an error. Ideally I would like to use them as
So I guess they should act like numbers, perhaps as rationals? (though in that case we should try to get some performance optimisations so that when used with floats they are inlined to the appropriate constants) |
As long as they're constants (that is, they can't be arbitrarily redefined) I'd be in favor of this; but if users can assign them as variables (i.e., |
We could potentially parse the vulgar fractions as numeric literals. Unlike \Bbbone they seem to have totally unambiguous meanings. |
One possible argument against doing this is in writing code that caches computation of expensive divisions, e.g. naming a variable |
Both the syntaxes |
The only change I can imagine making here is allowing these characters in initial position (for identifiers, or perhaps as numeric literals in the case of fractions), in which case it will be non-breaking. Moving out of 1.0. |
Fixed by #32838. |
I wanted to use
\Bbbone
(𝟙) as a variable name (on latest master) but it gives the following error:Other less common characters, such as
\mbfitsansvarpi
, just above it in the Unicode input list do work.Is this deliberate since it's "sort of a number"?
The text was updated successfully, but these errors were encountered: