[[Invoke]] vs [[Get]]

Brian Di Palma offler at gmail.com
Sat Jun 8 10:41:26 PDT 2013


If you have a [[Get]] trap it seems wrong to skip it when you also
have an [[Invoke]] trap.
Maybe you should execute the [[Get]] first and feed its result into
the [[Invoke]] one?

obj.method();

I'd expect the [[Get]] to always have its say and not to be just
ignored in a possibly dynamic fashion.

On Sat, Jun 8, 2013 at 11:30 AM, Till Schneidereit
<tschneidereit at gmail.com> wrote:
> At the last TC39 meeting, an agreement was reached for proxies to support an
> Invoke trap. I'm currently implementing this trap in SpiderMonkey[1] and
> realized that there's one conceptual issue that has to be decided in the
> spec:
>
> Currently, the [[Get]] trap naturally handles method calls on the proxies,
> as these are gets followed by calls to the returned function value. With
> proxies also being able to trap [[Invoke]], things become less clear, with
> four possible options:
>
> 1. for method calls, only the [[Invoke]] trap is called
> 2. if an [[Invoke]] handler exists, it is called, otherwise a [[Get]]
> handler is called, if that exists
> 3. like 2., but additionally, if the [[Invoke]] handler doesn't return a
> callable value, the [[Get]] handler is called
> 4. like 3., but with reserved order of handler invocation: if a [[Get]]
> handler exists, it is called. If the result isn't callable, or [[Get]] isn't
> handled, an [[Invoke]] handler is called, if one exists
>
> The first of these options seems conceptually cleanest to me, but I do think
> that the other options (perhaps except for the last one) can be argued for
> to some extend, too: the abstract operation `Invoke`, via its step 5,
> `GetMethod`, contains a call to the [[Get]] operation, after all.
>
>
> [1]: https://bugzilla.mozilla.org/show_bug.cgi?id=878605
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>


More information about the es-discuss mailing list