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

Brendan Eich brendan at
Fri Dec 16 11:58:09 PST 2011

From: "David Bruant" <bruant.d at>
> Let's say we have two attenuators (proxies which reduce your authority over a given object) constructors we'd like to compose: makeAttenuated1 and makeAttenuated2 
> ----- 
> // assuming we have an object 'o' and a private name 'p' 
> var aao = makeAttenuated2(makeAttenuated1(o)); 
> aao[p] = 37; 
> ----- 
> The 'set' trap of the attenuator2 is called with p.public as name. Then, this attenuator cannot pass p.public to the attenuator1 proxy as a name since p.public is not a name object 

That's right. Only if the first attenuator is introduced to the private name, or otherwise has access (from birth), in an objcap-safe way, can it tell that p.public corresponds uniquely to p. If it wishes, it can then substitute p for p.public before forwarding to attenuator2.


More information about the es-discuss mailing list