[[Invoke]] and implicit method calls

Mark Miller erights at gmail.com
Tue Sep 24 10:18:36 PDT 2013


One bit of data: A google search on "uncurryThis" says it gives 21,500
results. We should expect that many uses of this and similar patterns do
not use it by this name, so this should be taken, in some sense[1], as a
lower bound indication of the breadth of interest in such patterns.

[1] Insert appropriate qualifiers about the noise in such "results" numbers.



On Tue, Sep 24, 2013 at 10:06 AM, Mark S. Miller <erights at google.com> wrote:

> I do not know and I do not know what to search on to find out. However, I
> would guess it is used enough to be a real concern. We documented it at <
> http://wiki.ecmascript.org/doku.php?id=conventions:safe_meta_programming>
> for reasons that are not Caja specific. That page followed from Axel's <
> http://www.2ality.com/2011/11/uncurrying-this.html> which is also not
> Caja specific. Both have been public advice posted in places prominent to
> the JS community for a long time. There was also an earlier discussion on
> es-discuss about exactly this integrity issue, that was again not Caja
> specific.
>
> But anyway, another point of my email is that I don't understand what
> problem you're trying to solve. The reason for using this pattern, rather
> than the much simpler thing.f(...args) is to take control away from thing.
> If you give control back to thing anyway, what's the point? If you want
> thing to have control, why not write thing.f(...args) ?
>
>
>
> On Tue, Sep 24, 2013 at 9:47 AM, Allen Wirfs-Brock <allen at wirfs-brock.com>wrote:
>
>>
>> On Sep 24, 2013, at 7:37 AM, Mark S. Miller wrote:
>>
>> Thanks to André and Tom, I think I now understand the problem. I think
>> the only solution lies in this comment from Tom:
>>
>>
>> On Tue, Sep 24, 2013 at 1:23 AM, Tom Van Cutsem <tomvc.be at gmail.com>wrote:
>>
>>> [...] The generic solution is membranes. Anything else needs
>>> application-specific consideration.
>>>
>>
>>  But right above it he says
>>
>> To solve all of that, you'd need proper membranes. But using membranes to
>>> fix the this-rebinding problem seems like total overkill.
>>
>>
>> A solution that works is better than one that doesn't. We always knew
>> that patterns of proxies short of membranes would have abstraction leakage.
>> This is one. What is wrong with the stance: Live with it or use membranes,
>>
>> In answer to Tom's later question, Caja code does use the pattern
>>
>>     f.call(thing);
>>
>> a lot. Or even
>>
>>
>> Mark,
>>
>> In the wild, how often do you think F.p.call is used with these sorts of
>> integrity guarantees in mind?  Does anybody other than Caja do it?   If we
>> are really only talking about Caja, it presumably could adapt to using
>> Reflect.apply.
>>
>> Allen
>>
>>
>>
>
>
> --
>     Cheers,
>     --MarkM
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>


-- 
Text by me above is hereby placed in the public domain

  Cheers,
  --MarkM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130924/517c6949/attachment.html>


More information about the es-discuss mailing list