On Sep 10, 2013, at 5:15 AM, Till Schneidereit wrote: > On Tue, Sep 10, 2013 at 1:31 PM, Domenic Denicola > <[email protected]> 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 9.2.4.11 and 9.3.11 would have to be dealt with similarly, by > introducing non-typeerror-throwing [[MaybeInvoke]] versions.
However, it appears that using that approach you can't distinguish between a missing/non-callable property value and a method invocation that actually returned undefined. I think if we had [[MaybeInvoke]] we would have to define it so that we could make that distinction. Perhaps by returning a a tuple [success, value] However, I think the [[InvokeFunction]] is a better solution. Allen
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

