Symbol history
kai zhu
kaizhu256 at gmail.com
Fri Jun 1 15:55:23 UTC 2018
> As far as the spec is concerned...
>
> Symbols were introduced in draft 12 of ES6.
> They were defined as a kind of exotic object, stateless and immutable.
>
> In draft 15, Symbol became a primitive type.
> In draft 16, it went back to being a kind of exotic object.
> In draft 19, it went back to being a primitive type.
can i ask why they were changed to primitive-type instead of exotic-object? what are the disadvantages of keeping symbols as objects (with an extra Object.isSymbol subtype-check)?
because one obvious advantage from what i see, is to avoid breaking backwards-compatibility with previously stable-code (since es1 in 1997 [1]) that rely on typeof checks:
```js
if (typeof foo === ...) {
...
} else {
// break backwards-compatibility with stable-code since es1
// due to unexpected symbol-case
...
}
```
[1] ECMA-262, 1st edition, June 1997
https://www.ecma-international.org/publications/files/ECMA-ST-ARCH/ECMA-262,%201st%20edition,%20June%201997.pdf <https://www.ecma-international.org/publications/files/ECMA-ST-ARCH/ECMA-262,%201st%20edition,%20June%201997.pdf>
kai zhu
kaizhu256 at gmail.com
> On 29 May 2018, at 3:33 PM, T.J. Crowder <tj.crowder at farsightsoftware.com> wrote:
>
> Thanks all!
>
> On Mon, May 28, 2018 at 7:36 PM, Michael Dyck <jmdyck at ibiblio.org <mailto:jmdyck at ibiblio.org>> wrote:
> > As far as the spec is concerned...
>
> Thanks. Sorry Michael, I should have been more clear: I'm talking about the history _leading up_ to the spec.
>
> On Mon, May 28, 2018 at 7:33 PM, Allen Wirfs-Brock <allen at wirfs-brock.com <mailto:allen at wirfs-brock.com>> wrote:
> > That's a pretty good summary
>
> On Tue, May 29, 2018 at 2:51 AM, Allen Wirfs-Brock <allen at wirfs-brock.com <mailto:allen at wirfs-brock.com>> wrote:
> > A good starting point for researching the history is:
> > https://web.archive.org/web/20110505015255/http://wiki.ecmascript.org:80/doku.php?id=strawman:private_names <https://web.archive.org/web/20110505015255/http://wiki.ecmascript.org:80/doku.php?id=strawman:private_names>
>
> Thanks Allen. If the summary was good enough, that's as much detail as I need to get into.
>
> Thanks again all!
>
> -- T.J. Crowder
> _______________________________________________
> 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/20180601/805c239c/attachment.html>
More information about the es-discuss
mailing list