Are Private name and Weak Map the same feature? and the Assoc API

David Herman dherman at
Fri Dec 16 12:03:47 PST 2011

On Dec 16, 2011, at 11:52 AM, David Bruant wrote:

> However, I have questions and concerns about the public counterpart. 
> Why does it exists?

It exists to prevent unintentionally leaking private names. When you have a private name and you do a property get of another object, if that object doesn't know about that private name, it can't do anything with it. With proxies, simply looking up a private name on an object is implicitly giving away access to the object you're doing the lookup on. This means anyone could intercept a private name by handing a proxy to code that's doing a lookup of a private-named key.

> (there are very few words on it on the wiki and no link to previous discussion) Is it only to "prevents unintended leakage of the private name [to proxies]" as said in the wiki or is there another use case?

It's critical for protecting the actual privacy of the names.


More information about the es-discuss mailing list