-
Notifications
You must be signed in to change notification settings - Fork 1.7k
num.parse #8237
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
Comments
I would make it parse any number literal allowed in the lexical grammar, and give the corresponding value. Removed Type-Defect label. |
Basically I want: |
Semantically I propose: num.parse(x, errorHandler) { Added Accepted label. |
This comment was originally written by @butlermatt I'd like to see this as well. Florian's comment #2 is what I would expect as well. Since the 'best practice' seems to be to be to prefer 'num' unless you explicitly require an int/double, I would expect that a num.parse() exist. With this missing it actually seems to enforce that you should use the explicit subtypes rather than num itself. |
Added Ready-to-implement label. |
Issue #1981 has been merged into this issue. |
Added Fixed label. |
There is int.parse, double.parse but no num.parse.
It should return an int if the string could be the output of ints (or if it's a hexadecimal literal), and otherwise return a double.
The text was updated successfully, but these errors were encountered: