Why ES6 introduced classes yet `Symbol` not to be used with `new`?
Andrea Giammarchi
andrea.giammarchi at gmail.com
Mon Aug 15 08:29:32 UTC 2016
just to clarify:
> I hope there won't be other inconsistent primitives/classes added to the
lang in the future.
meaning: I'd rather throw at every attempt to `new Boolean/Number/String`
too as amend in the future if "_primitives gotta primitive_" is the idea
and `Symbol` throwing was to help developers.
On Mon, Aug 15, 2016 at 9:27 AM, Andrea Giammarchi <
andrea.giammarchi at gmail.com> wrote:
> FWIW, if `Object(Symbol()) instanceof Symbol` is true, and it is, we can
> say `Symbol` is just an anomaly in the specs because it acts like other
> primitive constructors but it throws if used as `new Symbol()`.
>
> Developers that would've written `new Symbol` are the same that write `new
> Boolean` or `new Number` and `new String`.
>
> If these people don't put minimal effort to better learn/use the
> programming language I wonder why the rest of the entire community should
> be penalised with "quirks" like `Symbol` is.
>
> Throw at everything and then, or don't ... and keep it consistent in both
> good or bad expectations.
> I know it's too late for `Symbol` but I hope there won't be other
> inconsistent primitives/classes added to the lang in the future.
>
> Best Regards
>
>
> On Mon, Aug 15, 2016 at 12:15 AM, Domenic Denicola <d at domenic.me> wrote:
>
>> Symbol is not a class.
>>
>>
>>
>> *From:* es-discuss [mailto:es-discuss-bounces at mozilla.org] *On Behalf Of
>> */#!/JoePea
>> *Sent:* Sunday, August 14, 2016 18:31
>> *To:* es-discuss <es-discuss at mozilla.org>
>> *Subject:* Why ES6 introduced classes yet `Symbol` not to be used with
>> `new`?
>>
>>
>>
>> It seems like `new Symbol()` would be inline with the introduction of
>> classes. Why was it chosen not to be constructible? Seems like it would
>> make sense to throw an error on `Symbol()` but not `new Symbol()`. Was it
>> to save three characters of typing?
>>
>>
>> */#!/*JoePea
>>
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss at mozilla.org
>> https://mail.mozilla.org/listinfo/es-discuss
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20160815/8f58c3c7/attachment.html>
More information about the es-discuss
mailing list