-
-
Notifications
You must be signed in to change notification settings - Fork 655
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
Refactor string utils for better consistency #608
Conversation
Hmm, initial idea here was that the |
In current PR I'm proposing put this in utils and reexport to std/string. My thoughts are better all implementations be in one place instead |
So, the problem seems to be that the implementation of `parseFloat´ is at top-level, while the implementations for integers are in util, I guess? What if we keep the integers, and refactor just parseFloat (maybe becoming generic) to use a similar design? |
Or better move |
Aren't really builtins, but one could argue that isNaN and similar should be moved to number. Removing parseI32/I64 sounds good! |
I also renamed internal |
@@ -331,23 +345,23 @@ export abstract class F64 { | |||
static readonly NaN: f64 = NaN; | |||
|
|||
static isNaN(value: f64): bool { | |||
return builtin_isNaN<f64>(value); | |||
return isNaN<f64>(value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like it will conflict if we ever align the resolver with JS to also take the current function's name into account.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if I declare it as function internal_isNaN
without export and in the end of file export as:
export { internal_isNaN as isNaN, internal_isFinite as isFinite }
?
} | ||
|
||
static isFinite(value: f64): bool { | ||
return builtin_isFinite<f64>(value); | ||
return isFinite<f64>(value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same. Not sure how TS handles this if general signatures differ, like one being generic and the other not.
Moving
parseFloat
/parseInt
/parseI32/64
fromstd/string
tostd/util/string