Throwing when symbol *wrappers* are converted to primitives

Axel Rauschmayer axel at
Fri Dec 26 23:17:40 PST 2014

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.

Dr. Axel Rauschmayer
axel at

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list