Adding [[Invoke]] to address issues with methods called on Proxies
brandon at brandonbenvie.com
Tue Jan 29 10:19:23 PST 2013
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 ultimately complicates
the object model and these are fallout from it, but most of us agree that
Proxies are worth it.
2.) The abstract method Invoke already exists in the spec. This is a thing
that the ES6 spec, with its deferring to prototypal inheritance for some
things previously limited to internal properties, needs. Adding
[[CallProperty]] would probably be a near net-zero change (perhaps a
net-reduction) in total spec complexity, since Invoke already exists in the
spec and is largely subsumed by [[CallProperty]].
On Tue, Jan 29, 2013 at 12:56 PM, Herby Vojčík <herby at mailbox.sk> wrote:
> Brandon Benvie wrote:
>> To elaborate, I've realized that my main disagreement with your position
>> (really my care at all with the private discussion) is much better
>> solved by introducing [[CallProperty]]. That is: Proxies currently
> ... 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 [[Get]]+[[Call]]).
> I'd solve it otherwise. Let's say that foo.bar(baz) is split to _three_
> operations: [[Get]]+[[OopBind]]+[[Call]], where [[OopBind]] resolves this.
> Then, proxies should only be able to trap [[OopBind]] (but it will still be
> the same combination, involving trappable [[Get]] at the beginning and
> ending with (direct) [[Call]]).
> handle |this| binding of method calls very poorly. I'm all for either
>> removing private or making it *really* private, but Proxies are
>> basically worthless in the private middleground which causes them to
>> break half the time in ES6 code. But [[CallProperty]] fixes the issue in
>> a way that seems acceptable to all parties.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss