[Harmony Proxies] get/set trap receiver argument unnecessary

David Bruant david.bruant at labri.fr
Thu Apr 28 01:26:56 PDT 2011


Le 27/04/2011 23:09, Sean Eagan a écrit :
> As explained before, the existing ES5 semantics would cause the proxy's
> "getPropertyDescriptor" trap to be called thus obtaining any "getter"
> / "setter" that the proxy wants.  The |this| binding of this "getter"
> / "setter" will then be set to the "receiver" by ES5 8.12.3 step 13
> for a "getter" or ES5 section 8.12.5 step 5.b for a "setter".  The
> proxy's "get" / "set" trap would not get called, and thus would not
> need the "receiver" arguments.
Interesting. What you're saying is that if a proxy in on the prototype 
chain, then its "set" and "get" traps are never called by a get or set 
on the base object.

In any case, in any example we could write, the |this| binding is 
correct not because of the get/set trap on the prototype chain, but 
because of the |this| binding that is performed at the own layer level.

I think you're right on removing the receiver argument.
It should be noted that on that page [1] there is a consensus that a 
receiver argument should be added to all proto-climbing traps. I don't 
think we've had the explanation of this point yet. If I recall 
correctly, this necessity was raised by Andreas Gal (CC'ed). 
SpiderMonkey-related bug [2]

David

[1] http://wiki.ecmascript.org/doku.php?id=strawman:handler_access_to_proxy
[2] https://bugzilla.mozilla.org/show_bug.cgi?id=643100


More information about the es-discuss mailing list