@mathias Why don't you use `BigInt.parse`, `Number.parse` instead of `fromString`? With `parse` you are going to be a consistent with `JSON` API and SyntaxError would make more sense than now.
-
-
Replying to @abozhilov
It’s not gonna be consistent with JSON either way as there’s no {BigInt,Number}
#stringify.1 reply 0 retweets 0 likes -
Replying to @mathias
Sure, but throwing yet another runtime SyntaxError from different method name is confusing. If there were `ValueError` then it would make more sense.
1 reply 0 retweets 0 likes -
Replying to @abozhilov
ValueError is not a native error type in ECMAScript, though: https://tc39.github.io/ecma262/#sec-native-error-types-used-in-this-standard … Options are: - EvalError - RangeError - ReferenceError - SyntaxError - TypeError - URIError SyntaxError is the only one that makes sense, IMHO.
1 reply 0 retweets 0 likes -
Replying to @mathias @abozhilov
is detailed SyntaxError makes sence for parsing primitive types? 99% of ppl will wrap parse code into try/catch and return null if error. And that try/catch will deoptimize code. I always prefer parse(string) -> Maybe<Result> aka Result | null for that cases
2 replies 0 retweets 0 likes
“try/catch will deoptimize code” — this hasn’t been true in @v8js since the introduction of TurboFan.
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
JavaScript, HTML, CSS, HTTP, performance, security, Bash, Unicode, i18n, macOS.