Re: [whatwg/streams] JSIDL vs WebIDL (#45)

> Oh, I thought that 4.2.3 and 4.8.9 says it returns Promise or undefined.

The "Note" section in 4.2.3 is non-normative, and priority is given to making it easy-to-understand. See https://github.com/whatwg/streams/issues/566.

Chasing the definition of PromiseInvokeOrNoop, we get

> 4. Let _returnValue_ be InvokeOrNoop(_O_, _P_, _args_).
> 5. If _returnValue_ is an [abrupt completion](https://tc39.github.io/ecma262/#sec-completion-record-specification-type), return [a promise rejected](https://www.w3.org/2001/tag/doc/promises-guide/#a-promise-rejected-with) with returnValue.[[Value]].
> 6. Otherwise, return [a promise resolved](https://www.w3.org/2001/tag/doc/promises-guide/#a-promise-resolved-with) with _returnValue_.[[Value]].

Chasing "a promise resolved", we see

> "**A promise resolved with** _x_" or "_x_ **resolved as a promise**" is shorthand for the result of `Promise.resolve(x)`, using the initial value of [Promise.resolve](https://tc39.github.io/ecma262/#sec-promise.resolve).

Tracing through the ES spec is exhausting, but you'll eventually end up here: https://tc39.github.io/ecma262/#sec-promise-resolve-functions which explains how Promise.resolve handles different types of value.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/issues/45#issuecomment-293533188

Received on Wednesday, 12 April 2017 10:10:47 UTC