Why ES6 introduced classes yet `Symbol` not to be used with `new`?

Domenic Denicola d at domenic.me
Mon Aug 15 04:18:18 UTC 2016

I believe, but am not sure, that we also decided we would follow that pattern for any future primitive types, since in general constructing wrapper objects is a bad idea. (I want to say that wrapper objects themselves are a bad idea, but I think the conclusion was more subtle than that... they are an important part of the semantics, it's just unfortunate that they're so easy to create.)

If some enterprising person wants to dig through the meeting notes, there might be some hints there...

> From: Allen Wirfs-Brock [mailto:allen at wirfs-brock.com] 
> Because, to be consistent with Number/String/Boolean you would expect `new Symbol()` to create a  Symbol wrapper object.  But we anticipated that if `new Symbol` was allowed many devs (who lacked an understanding of the difference between primitive values and wrapper objects for primitive values) would code `new Symbol()` with the  expectation that they were creating a Symbol value. This would be a silent bug so we disallowed `new Symbol()`.

More information about the es-discuss mailing list