-
-
Notifications
You must be signed in to change notification settings - Fork 670
feat: Introduce new parse methods for builtin value types. Deprecate XX.parseInt/parseFloat #2465
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
Conversation
To summarize what we have talked about, I think we should keep non-standard additions on the respective lowercase namespaces, here |
Yes, I added non-standard "parse" methods only for lowercase types. At the moment, the |
Why remove if portable mode still needs? |
|
Oh, got it. I overlooked. |
Also note |
New static methods:
Deprecated:
Motivation
U8.parseInt
andF32.parseInt
/F32.parseFloat
are a tracing ofNumber.parseFloat
andNumber.parseInt
which makes sense in JS due to we have on Number and can't distinguish from int and float.In AssemblyScript we have a completely different story. So I propose to declare these methods obsolete and use simpler and clearer names for parsing instead.
It is also good correlated with
Date.parse
,Temporal.parse
andJSON.parse
Portability compatibility
globalThis.parseFloat === Number.parseFloat
andglobalThis.parseInt === Number.parseInt
. It's just aliasing introduced in ES2015 for better modularize. So you can just useparseFloat
/parseInt
is you want to suppress a deprecated warns in editor