On Apr 28, 2011, at 1:26 AM, David Bruant wrote:

> 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]

Actually we are still going back and forth on this. Proto-climbing might be the 
wrong selector here. "Can call a getter or setter" seems to be the better 
category, and that would be only get and set. get and set definitely do need 
the receiver though. If you have a proxy on the proto chain and you don't find 
what you are looking for in the direct object, the next step is invoking get on 
the prototype (proxy), and you need the proper receiver if you have to call a 
getter (the direct object, not the proxy).

I initially assumed that you would need receiver everywhere where you delegate 
along the proto chain, but it became clear to me that you actually don't call a 
getter/setter in most cases (except get/set), so the proper receive can be 
supplied later when the getter/setter is actually called. I will revisit this 
with Tom and Mark and dherman before the next TC39 meeting to come up with a 
more formal analysis of what we need.

Andreas

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

_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to