Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upWhy Number(symbol) crashes? #712
Comments
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
leobalter
Oct 14, 2016
Member
Number(value) calls the abstract operation ToNumber(value), which throws a TypeError when value is a Symbol.
Why do you want to cast a symbol value to a Number?
We have this mailing list for this kind of discussion: http://esdiscuss.org/
|
Number(value) calls the abstract operation ToNumber(value), which throws a TypeError when value is a Symbol. Why do you want to cast a symbol value to a Number? We have this mailing list for this kind of discussion: http://esdiscuss.org/ |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
domenic
Oct 14, 2016
Member
This doesn't appear to be an issue with the current specification, and as such is not appropriate for this repo. es-discuss or StackOverflow are good ways to get clarification on specification and language usage questions.
|
This doesn't appear to be an issue with the current specification, and as such is not appropriate for this repo. es-discuss or StackOverflow are good ways to get clarification on specification and language usage questions. |
domenic
closed this
Oct 14, 2016
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
medikoo
Oct 14, 2016
Why do you want to cast a symbol value to a Number?
I didn't say I want to do that. I said that specification seems inconsistent in handling non-number coercible values, and I'm wondering what's the reasoning.
medikoo
commented
Oct 14, 2016
I didn't say I want to do that. I said that specification seems inconsistent in handling non-number coercible values, and I'm wondering what's the reasoning. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
medikoo
Oct 14, 2016
@domenic I thought http://esdiscuss.org/ is not longer a place where TC39 is involved. Anyway thanks for redirection
medikoo
commented
Oct 14, 2016
|
@domenic I thought http://esdiscuss.org/ is not longer a place where TC39 is involved. Anyway thanks for redirection |
medikoo commentedOct 14, 2016
I was searching available resources but wasn't able to find the answer.
What's the reasoning behind having
Number(symbol)crash instead of returningNaN(as it's in the case all other non-coercible values that expose some primitive representation)? It feels not consistent.If someone can point me to some discussion that provided the reasoning I'd be grateful.
I originally posted this question at Mozilla discussion group, but it feels a bit abandoned. If this repository is not right place for such questions, I'll be glad if you direct me to the right one. Thanks!