Re: [heycam/webidl] Import the Promises Guide. (#772)

domenic commented on this pull request.



>      1.  Let |onRejected| be [=!=] [$CreateBuiltinFunction$](|onRejectedSteps|, « »):
     1.  Let |constructor| be |promise|.\[[Promise]].\[[Realm]].\[[Intrinsics]].[[{{%Promise%}}]].
     1.  Let |newCapability| be ? [$NewPromiseCapability$](|constructor|).
     1.  Return [=!=] [$PerformPromiseThen$](|promise|.\[[Promise]], |onFulfilled|, |onRejected|, |newCapability|).
 
     Note: If the provided steps return a value of type |T|, this algorithm returns a
-    <a interface lt="Promise">Promise&lt;|T|&gt;</a>.
+    <code>{{Promise}}<var ignore>T</var>&gt;</code>.
+</div>
+
+<div algorithm>
+    To perform some steps <dfn export for=Promise>upon fulfillment</dfn> of a

Realistically I think most of these don't need for=Promise; there's no competition to disambiguate with. At least, not the ones that explicitly have "promise" in their name, for sure...

>  
 <div id="es-to-promise" algorithm="convert an ECMAScript value to promise">
 
     An ECMAScript value |V| is [=converted to an IDL value|converted=]
-    to an IDL <a interface lt="Promise">Promise<var ignore>T</var></a> value as follows:
+    to an IDL <code>{{Promise}}&lt;<var ignore>T</var>></code> value as follows:

This pattern results in nested `<code>`. I guess that's not technically invalid? But what would work better would be the verbose

```html
<code><a interface>Promise</a>&lt;<var ignore>T</var>></code>
```

>          1.  Let |R| be the first argument to |onRejected|.
         1.  Let |reason| be the result of [=converted to an IDL value|converting=]
             |R| to an IDL value of type {{any}}.
         1.  If there are no steps that are required to be run if the promise was rejected, then
             return <emu-val>undefined</emu-val>.
         1.  Otherwise, return the result of performing any steps that were required to be run if the promise was rejected,
             with |reason| as the rejection reason.
-    1.  Return [=!=] [$PerformPromiseThen$](|promise|, |onFulfilled|, |onRejected|).
+    1.  Let |onRejected| be [=!=] [$CreateBuiltinFunction$](|onRejectedSteps|, « »):
+    1.  Let |constructor| be |promise|.\[[Promise]].\[[Realm]].\[[Intrinsics]].[[{{%Promise%}}]].
+    1.  Let |newCapability| be ? [$NewPromiseCapability$](|constructor|).
+    1.  Return [=!=] [$PerformPromiseThen$](|promise|.\[[Promise]], |onFulfilled|, |onRejected|, |newCapability|).

I guess we can just update all callers to say "Let _x_ be the result of performing the following steps upon fulfillment of _p_, given _v_" instead of the current "Let _x_ be the result of transforming _p_ by the following fulfillment steps, given _v_". That's not very different.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/heycam/webidl/pull/772#pullrequestreview-279147088

Received on Friday, 23 August 2019 18:11:35 UTC