New private names proposal

David Herman dherman at mozilla.com
Thu Dec 23 15:55:42 PST 2010


On Dec 23, 2010, at 4:27 PM, David-Sarah Hopwood wrote:

> We don't know whether [] will be changed
> at all. (In the proposal to add a @ or .# operator, it isn't.)

Hm, this looks like a pretty serious misunderstanding of the private names proposal. In every variant of the proposal, the object model is changed so that private name values are allowable property keys. This means that in every variant of the private names proposal, [] can't be defined via a local transformation. This has *nothing* to do with the @ or .# operators. For example:

    var x = gensym(); // x is a new name value
    ... obj[x] ...    // the property of obj with private name x

In other words, the core of the private names proposal -- generalizing object property lookup to allow name values in addition to strings -- is a semantic change, not a syntactic one. (IOW, if you wanted to dress it up to look like a syntactic change, you would have to do a global transformation of [] expressions -- in short, you'd have to write a compiler.)

This is a central part of the private names proposal. It can't be eliminated from the proposal. So if you want to compare apples to apples, you have to *add* this feature to the soft fields proposal. As I've said, when you make this apples-to-apples comparison, I believe the soft fields version is problematic because it makes side-table lookup appear as though it's property lookup.

I think I've made this point several points now; it'd be great to get some sort of reply.

Dave



More information about the es-discuss mailing list