Symbols, Protocols, Frames, and Versioning

Brendan Eich brendan at mozilla.com
Thu Oct 4 10:05:21 PDT 2012


Kevin Smith wrote:
>
>     Dave Herman mentioned another idea: intern'ing strings as symbols.
>     You'd lose uniqueness but avoid colliding with any string. So
>
>       public @iterator = Symbol.intern('iterator');
>
>     Is this much better than just using 'iterator' or dunder-iterator?
>
>
> Apologies, but what would interning a string as a symbol mean?

Different frames could load a module that does this and the symbol would 
be interned as a singleton in all connected realms.

The rendezvous would be on the name, so of course collisions are 
possible. Symbol.intern('org.ecma-international.es6.iterator') -- blech!

/be


More information about the es-discuss mailing list