Are Private name and Weak Map the same feature? and the Assoc API
Tom Van Cutsem
tomvc.be at gmail.com
Mon Dec 19 07:51:17 PST 2011
2011/12/19 David Bruant <bruant.d at gmail.com>
> The public part is an unforgeable object (with the same .toString than
> the private name), so there is no ambiguity in a public->private map.
> You use the unforgeable public object as key in the map, so no collision
> issue due to string forgeability.
Again, the private names proposal is vague in this respect. I am under the
impression that it passes ToString(privateName.public) to the "get" trap.
> > In any case, by separating private name access out into separate
> > traps, if a proxy writer only implements get/set but not
> > getPrivate/setPrivate, then private name access would just be
> > forwarded to the proxy target by default, and there would be no need
> > for the proxy to maintain a public->private mapping for private names
> > it does not know or care about.
> If you define a getPrivate/setPrivate trap, does it have access to the
> private name directly or its public counterpart?
Only to the public counterpart, of course, otherwise we're back to square 1
and private names would leak.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss