names [Was: Approach of new Object methods in ES5]
P T Withington
ptw at pobox.com
Fri Apr 16 10:59:10 PDT 2010
On 2010-04-16, at 13:07, Brendan Eich wrote:
>> Another Harmony idea: http://wiki.ecmascript.org/doku.php?id=strawman:names for unforgeable property names not equated to any string. These cannot collide, and with sugar to let them be used with . (not only in computed property accesses using ), we may have a complete solution for injecting new "names" into standard prototypes without breaking existing code.
> Comments welcome on the names proposal. There are open issues at the bottom, and the "private" keyword syntax is straw for sure, although we don't have a better proposal AFAIK.
Name sounds like a stripped-down uninterned symbol (http://bit.ly/bY3Jkg) to me.
It's an object with a magic attribute that says, unlike any other object you might try to use it as a property name, it is not coerced into a string first. And it is compared by identity when looked up. And it is invisible to (all?) enumerations of property names.
I have to wonder if it would be a worthwhile generalization to be able to confer these magical attributes on arbitrary objects? This might allow more experimentation with namespace ideas.
More information about the es-discuss