Re: Why Number(symbol) crashes?

2016-10-11 Thread Jordan Harband
whoops, sorry, I missed the earlier thread. disregard. On Tue, Oct 11, 2016 at 5:53 PM, Jordan Harband wrote: > I'm not sure what you're asking. `Number(Symbol())` throws a TypeError. > > Perhaps are you using a Symbol sham (that only partially is able to > polyfill Symbols)?

Re: Why Number(symbol) crashes?

2016-10-11 Thread Jordan Harband
I'm not sure what you're asking. `Number(Symbol())` throws a TypeError. Perhaps are you using a Symbol sham (that only partially is able to polyfill Symbols)? In what browser/engine are you seeing `NaN`? On Tue, Oct 11, 2016 at 11:37 AM, Raul-Sebastian Mihăilă < raul.miha...@gmail.com> wrote:

Why Number(symbol) crashes?

2016-10-11 Thread Raul-Sebastian Mihăilă
How is NaN useful? Isn't it better to be explicit if you really want a string? ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: Why Number(symbol) crashes?

2016-10-11 Thread Oriol Bugzilla
In my opinion it's a bit incoherent that each object-coercible type behaves differently when coercing symbols to it. Symbols can be explicitly coerced to strings, but not implicitly: ```js String(Symbol("abc")); // "Symbol(abc)" Symbol("abc") + ""; // TypeError ``` Symbols can't be coerced to

Re: Why Number(symbol) crashes?

2016-10-11 Thread Kris Siegel
Symbol is such an oddball; similar to this if you do Symbol() + "" it will also throw an exception unlike all other built-ins. Granted I have no idea what a string representation of Symbol *really* would be but no other built in type behaves the way Symbol does. I do think Number(Symbol()) should

Why Number(symbol) crashes?

2016-10-11 Thread medikoo
I was searching the archived but wasn't able to find the answer. What's the reasoning behind having Number(symbol) crash instead of returning NaN (as it's in case all other non-coercible values?). It feels not consistent. If someone can point me to some discussion that provided the reasoning I'd