[[Invoke]] and implicit method calls
till at tillschneidereit.net
Tue Sep 10 05:15:05 PDT 2013
On Tue, Sep 10, 2013 at 1:31 PM, Domenic Denicola <
domenic at domenicdenicola.com> wrote:
> Note that determining desired pattern is relevant to the new DOM promises
> design (tracking this at
> https://github.com/domenic/promises-unwrapping/issues/25). Omitting a few
> steps not relevant to the issue under discussion, currently we do:
> - Let `then` be `Get(potentialThenable, "then")`.
> - If `IsCallable(then)`, call `then.[[Call]](potentialThenable, (resolve,
> It seems like we'd want to apply the same logic here as we do to `valueOf`
> etc., which is what I tried to model this after.
I guess for this case as well as for all or most of those Jason mentioned,
something like [[MaybeInvoke]] is required. I.e., a version of the
[[Invoke]] internal method that has step 5 replaced by "If Type(method)
is not Object, return undefined".
Sections 22.214.171.124 and 9.3.11 would have to be dealt with similarly, by
introducing non-typeerror-throwing [[MaybeInvoke]] versions.
Your above steps would then become
- call `potentialThenable.[[MaybeInvoke]]("then", (resolve, reject),
(probably with some results handling, but I don't know enough about
promises to include that, and it doesn't seem relevant.)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss