Adding [[Invoke]] to address issues with methods called on Proxies
herby at mailbox.sk
Tue Jan 29 11:29:17 PST 2013
Mark S. Miller wrote:
> On Tue, Jan 29, 2013 at 10:52 AM, Herby Vojčík <herby at mailbox.sk
> <mailto:herby at mailbox.sk>> wrote:
> Brandon Benvie wrote:
> Responding in this thread since it's a more appropriate place.
> 1.) It complicates the object model, in that it adds a new internal
> method to objects, but it also clarifies it. It falls under the same
> category as [[GetP]] and [[SetP]]: they complicate the object
> model, but
> they also clarify it and they are only observable to Proxies.
> All three
> are only observable to Proxies. Proxies are the thing that
> complicates the object model and these are fallout from it, but
> most of
> us agree that Proxies are worth it.
> Again, why add something that is "only observable to Proxies"? It is
> an exception, and it bring much more complication than straight
> rule. Such an exception is future-unfriendly.
> And I do not agree that it clarifies the object model. On the
> contrary. It makes it inconsistent.
> var quux = foo.bar;
> quux.call(foo, baz);
> was always equivalent of foo.bar(baz). Now, it is not.
> [[CallProperty]] is bad because it is alternative to [[Get]], in
> certain situations. What is the problem with, instead, doing it
> (imo) more properly, by reifying [[ChooseThis]](receiver, property)
> or something similar?
> Hi Herby,
> Perhaps I missed it, but could you expand on the [[ChooseThis]] idea? Or
> provide a link to an earlier discussion if it's already adequately
> covered? Thanks.
I replied it in another thread, but it was only on post, and it is
included here as well (I just called in [[OopBind]] but it was more or
less just [[ChooseThis]]):
> ... and complicates object model. My main problem with
> [[CallProperty]] is the discrepancy between [[Get]] (used in
> [[Get]]+[[Call]]) and [[CallProperty]] (my assumption that by
> [[CallProperty]] you mean operation that replaces
> I'd solve it otherwise. Let's say that foo.bar(baz) is split to
> _three_ operations: [[Get]]+[[OopBind]]+[[Call]], where
> resolves this. Then, proxies should only be able to trap
> (but it will still be the same combination, involving trappable
> [[Get]] at the beginning and ending with (direct) [[Call]]).
It is basically the idea that OOP call is three-part:
[[ChooseThis]] (by default choosing the base of Ref; trappable)
[[Call]] (in this context (receiver being proxy) untrappable; if a
function itself is proxy, it's already someone else's problem)
.apply and .call would do the last two.
More information about the es-discuss