New private names proposal

Brendan Eich brendan at mozilla.com
Thu Dec 16 22:44:54 PST 2010


On Dec 16, 2010, at 9:11 PM, David-Sarah Hopwood wrote:

> On 2010-12-17 01:24, David Herman wrote:
>> Mark Miller wrote:
>>> Ok, I open it for discussion. Given soft fields, why do we need private
>>> names?
>> 
>> I believe that the syntax is a big part of the private names proposal. It's
>> key to the usability: in my view, the proposal adds 1) a new abstraction to
>> the object model for private property keys and 2) a new declarative
>> abstraction to the surface language for creating these properties.
> 
> I don't like the private names syntax. I think it obscures more than it
> helps usability, and losing the x["id"] === x.id equivalence is a significant
> loss.

As Chuck Jazdzewski pointed out, this equivalence does not hold for id not an IdentifierName.

The new equivalence under private names would be x[#.id] === x.id.


> As Mark points out, though, that syntax can be supported with either
> proposal. The private names proposal is more entangled with syntactic
> changes, but that's a bug, not a feature.

No, that is a usability feature.

The inherited soft fields approach is more entangled with its reference implementation, which is not the efficient route VM implementors can swallow.

/be



More information about the es-discuss mailing list