Are Private name and Weak Map the same feature? and the Assoc API
herby at mailbox.sk
Wed Dec 21 03:47:52 PST 2011
From: Andreas Rossberg
Sent: Wednesday, December 21, 2011 12:06 PM
To: Tom Van Cutsem
Cc: Brendan Eich ; es-discuss
Subject: Re: Are Private name and Weak Map the same feature? and the Assoc
> The only thing I'm worried about at this point is that there has to be a
> simple way for the proxy to say "I'm not interested in intercepting this
> private name, just forward it to my target". Otherwise I'm afraid most
> proxies will wrongly forward a private name access as a normal property
Indeed, that looks like a problem.
I think your idea points in the right direction. In fact, there is no
reason to make it specific to private names, it might be useful for
public properties, too. Instead of simply having all-or nothing traps,
and making it the responsibility of each trap to forward unwanted
cases properly, allow traps to signal "I don't care, please forward"
on a per-property basis.
Unfortunately, I don't have a good suggestion for a convenient
interface, besides introducing a sentinel value that traps can return
(I am still puzzled how people can survive in dignity without variants
and tuples... :) ).
I was proposing some solutionto exactly this in "Forward proxies with
private names" thread. Not acceptable (especially the call, if exception is
too hard to swallow)?
More information about the es-discuss