Adding [[Invoke]] to address issues with methods called on Proxies

Brandon Benvie brandon at brandonbenvie.com
Tue Jan 29 10:13:51 PST 2013


Sorry, I wish I had thought through to the logical conclusion and presented
this as one email instead of four. The difference is that [[Invoke]]
accepts a function object, which implies the [[Get]] has already happened.
The issue with __noSuchMethod__ is not the receiver, it's the combination
of [[Get]] and [[Call]] into one operation. Currently, proxies need to
[[Get]] and a function object, and then [[Call]] that function object on
the receiver. Since the [[Get]] has to happen first, without knowledge of
what is happen to the receiver, that proxy then has to return a function
for *all* [[Get]]s, instead of returning undefined for actual [[Get]]s and
calling a trap for [[Get]]+[[Call]].

Or to make a long story short, __noSuchMethod__ *requires* a trap that
combines [[Get]]+[[Call]]. [[CallProperty]] is that trap.


On Tue, Jan 29, 2013 at 1:06 PM, Andrea Giammarchi <
andrea.giammarchi at gmail.com> wrote:

> I am not sure I understand but ... if you can solve the receiver object,
> what is exactly the difference/problem again with __noSuchMethod__ and the
> `this` receiver ? 'cause __noSuchMethod__ has been always used (regardless
> problems with getters and setters and stuff nobody used with
> __noSuchMethod__ a part from specifications) same way PHP __call($name,
> $arguments = array()) has been used since ever ... what am I missing that
> is so different with [[invoke]] ? Thanks for explaining.
>
>
> On Tue, Jan 29, 2013 at 7:57 AM, Brandon Benvie <brandon at brandonbenvie.com
> > wrote:
>
>> Err yes, sorry. I was assuming away the last "arguments" argument in al
>> three cases!
>>
>> On Tuesday, January 29, 2013, Allen Wirfs-Brock wrote:
>>
>>> or [[CallProperty]](receiver, property, arguments)
>>>
>>> I haven't had a chance to work through all the details yet, but this is
>>> something I want to explore as a solution to the Proxy forwarded identify
>>> issue.  It does have to work with both normal property access calls and
>>> with super calls.  Also, it needs to be consistent with the Proxy semantics
>>> of [[Get]]/[[Put]] when they trigger accessors.
>>>
>>> Allen
>>>
>>> On Jan 29, 2013, at 4:04 AM, Brandon Benvie wrote:
>>>
>>> > A superior third alternative is [[CallProperty]](receiver, property)
>>> (and, in retrospect, likely what awb intended) which would allow for both
>>> __noSuchMethod__ and correctly trapping super. This fits with
>>> [[CallProperty]] being the combination of [[Get]] with calling the method.
>>> > _______________________________________________
>>> > es-discuss mailing list
>>> > es-discuss at mozilla.org
>>> > https://mail.mozilla.org/listinfo/es-discuss
>>>
>>>
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss at mozilla.org
>> https://mail.mozilla.org/listinfo/es-discuss
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130129/fce938ab/attachment.html>


More information about the es-discuss mailing list