> This sounds great, but doesn't this kind of violate referential
> transparency?

That's a loaded criticism. JS doesn't have referential transparency in any 
meaningful sense. But it does generalize the meaning of the dot-operator to be 
sensitive to scoping operators, that's true.

> Couldn't the goals of this be achieved by having a Name constructor
> (albiet less convenient syntax, since you have to use obj[name],
> perhaps that is what you are addressing) or having private name create
> a name Name (to be used like obj[name])?

You can do the same thing with the current proposal (except that private names 
in Allen's strawman are primitive values and not objects). You can write a 
library that produces new private name values, and you can use the bracket 
operator to get and set properties with that name.

But your "albeit less convenient syntax" is the crux of why I like the proposal 
as is. I would much rather write (and I suspect many programmers would as well):

    function Point(x, y) {
        private x, y;
        this.x = x;
        this.y = y;
        ...
    }

than

    function Point(x, y) {
        var _x = gensym(), _y = gensym();
        this[_x] = x;
        this[_y] = y;
    }

Dave

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

Reply via email to