[[Invoke]] and implicit method calls

Till Schneidereit 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,
> reject))`.
> 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[1] that has step 5 replaced by "If Type(method)
is not Object, return undefined".

Sections 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.)

[1]: http://people.mozilla.org/~jorendorff/es6-draft.html#sec-9.1.11
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130910/6c65c0e9/attachment.html>

More information about the es-discuss mailing list