Interesting, thanks! Can you explain the rationale behind that decision? To me, it seems like V8’s behavior is preferable – if I accidentally created instances of `Symbol`, I would want to get errors as early as possible.
> On 27 Dec 2014, at 08:41, Claude Pache <[email protected]> wrote: > > I guess that V8 follows an old version of the spec draft. That particular > behaviour was modified in Rev 28. See: > > https://bugs.ecmascript.org/show_bug.cgi?id=3252 > <https://bugs.ecmascript.org/show_bug.cgi?id=3252> > > —Claude > > Le 27 déc. 2014 à 08:17, Axel Rauschmayer <[email protected] > <mailto:[email protected]>> a écrit : > >> This is current V8 behavior: >> >> ``` >> > let obj = {}; >> > obj[Object(Symbol())] = true; >> TypeError: Cannot convert object to primitive value >> >> > '' + Object(Symbol()) >> TypeError: Cannot convert a Symbol wrapper object to a primitive value >> ``` >> >> Both exceptions make a lot of sense, but I don’t see that in the spec. The >> way I’d expect it to happen is via `Symbol.prototype[@@toPrimitive]` – it >> would always throw. But that’s not the case. >> >> https://people.mozilla.org/~jorendorff/es6-draft.html#sec-symbol.prototype-@@toprimitive >> >> <https://people.mozilla.org/~jorendorff/es6-draft.html#sec-symbol.prototype-@@toprimitive> -- Dr. Axel Rauschmayer [email protected] rauschma.de
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

