2013/6/8 Till Schneidereit <[email protected]> > I just saw that Jason identified some additional open questions in [1]: > > 1. What happens when we call a method on an object whose [[Prototype]] is > a proxy with an invoke trap? > > var p = new Proxy({}, {invoke: ...}); > var q = Object.create(p); > q.f(); > > Does this trigger p's invoke trap? >
Yes. "invoke", like "get", "set", "has" and "enumerate" should be one of the traps that can be called on a proxy used as a prototype. > 2. What happens when a proxy with an invoke trap is used in a with-block? > > with (p) > f(); > > Well, I guess it should trigger the invoke trap, just like writing simply "f" would trigger the proxy's get trap. > 3. When exactly do we check for an invoke trap, and when do we call it? > How does that affect 11.2.3? > https://people.mozilla.com/~jorendorff/es6-draft.html#sec-11.2.3 > > In an expression like p.f(), do we still evaluate "p.f" as in 11.2.3 step > 1? > No, we can't just blindly call GetValue in step 1 as that would lead to the "get" trap being invoked on a proxy (which is the wrong trap). I believe Allen had previously experimented with an invoke trap (called "callProperty") in a fork of the ES6 draft. Allen, can you comment on how you would see [[Invoke]] specced? Cheers, Tom
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

