On Thu, Oct 4, 2012 at 8:27 AM, Brendan Eich <[email protected]> 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?
I like it! Yes, I think it's better than just using 'iterator'. Pushing these things into a separate namespace, as this effectively does, avoids most of the accidental collisions. It also lets you do collision-avoidance via ad hoc namespacing without paying the long-name tax more than once (when you first create the Symbol). It might be useful to expose this functionality with a more obvious name, to underscore that you lose the secrecy/unforgability. Symbol.public()? ~TJ _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

