Allen Wirfs-Brock wrote:
presumably, looking up "iterator" in a registry of string/symbol key value pairs. Creating a new entry if one isn't present, and regardless returning the symbol value associated with the string.

public @iterator = Symbol('iterator');

No, I wrote Symbol.intern('iterator') on purpose. What you wrote just makes a unique symbol with debugging/diagnostics string associated with it.

conceptually could just as easily be expressed as:

public @iterator = RegistryOfWellKnownSymbols.lookup('iterator');

Yes, Symbol.intern would be just like that -- but shorter and standard if we choose to do it.

/be

Allen


On Oct 4, 2012, at 10:01 AM, 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?

Kevin

_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org <mailto:es-discuss@mozilla.org>
https://mail.mozilla.org/listinfo/es-discuss

_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to