Symbols, Protocols, Frames, and Versioning

Brendan Eich brendan at mozilla.org
Thu Oct 4 10:06:28 PDT 2012


As noted, this loses symbol uniqueness but avoids string vs. string name 
collisions in objects. It takes on string-name collisions in the 
intern'ed symbol table of course. That may be more manageable. Or not!

/be

Brendan Eich wrote:
> 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
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>


More information about the es-discuss mailing list