proxies: receiver argument and object maps

David Bruant bruant.d at
Sun Oct 16 14:44:35 PDT 2011

Le 16/10/2011 23:02, David Herman a écrit :
> Forgive me that I've not kept track of where we are in the discussion about the additional receiver argument.
> I think I just found a pretty important use case for the receiver argument. Say you want to keep some information about a proxy object in a Map or a WeakMap, and you want the handler to be able to access that information. Then you're going to need the proxy object to do it.
> I suppose you can close over the proxy value:
>     var proxy;
>     var handler = { ... proxy ... };
>     proxy = Proxy.create(handler);
> But then you have to make a fresh handler for each instance.
There are 2 different things:
1) the receiver object.
This one may only be useful in case of inheritance:
var p = Proxy.create(someHandler);

var o1 = Object.create(p);
var o2 = Object.create(p);

here, both o1 and o2 delegates their "get" to the proxy... so we
thought. Sean Eagan started a thread which conclusion was based on the
semantics of [[Get]], you never call the [[Get]] of the prototype, but
rather its [[GetProperty]] internal. Consequently, you never need the
receiver. Not even for the tricky case of getter/setter binding. See

But in my event as property experiment, I have found that I actually
need that I need the receiver object somewhere to properly implement
inherited events. I'll post on es-discuss as soon as I'm done to make my
case and argue back in favor of receiver.

2) the proxy object
It seems to be what you're describing
Several arguments and experiments have been made proving that proxy as
an argument was necessary for all traps. See

I think we're waiting for the November TC39 meeting for decisions to be
made regarding proxies.


More information about the es-discuss mailing list