[[Invoke]] and implicit method calls
jason.orendorff at gmail.com
Mon Sep 9 14:37:01 PDT 2013
There are some places in the spec where we might use [[Invoke]], but don't:
- implicit .toString() and .valueOf() calls
- implicit .toJSON() calls
- calls to Proxy handler methods
This seems unfortunate. Proxies with default handlers will work in
most places, thanks to the default [[Invoke]] trap, but not in ("" +
Is this still likely to change?
The apparent reason [[Invoke]] is not used in these places is that
they all do a [[Get]] first and check whether the property has a
callable value. But in the algorithm for yield*, in 22.214.171.124, we have
a similar check-before-calling situation, implemented using a
(step 4.d.viii in the last algorithm of 126.96.36.199)
> 1. If HasProperty(iterator, "throw") is true, then
> a. Let innerResult be the result of Invoke(iterator, "throw", (received)).
Having a [[GetMethod]] hook instead of an [[Invoke]] hook might make
it easier to use consistently everywhere.
More information about the es-discuss