Re: [heycam/webidl] Add the ability to construct a callback function (#328)

domenic commented on this pull request.



> +                href="#construct-return"><i>return</i></a>.
+            1.  Append |convertResult|.\[[Value]] to |esArgs|.
+            1.  Set |count| to |i| + 1.
+        1.  Set |i| to |i| + 1.
+    1.  Truncate |esArgs| to have length |count|.
+    1.  Let |callResult| be [=Construct=](|F|, |esArgs|).
+    1.  If |callResult| is an abrupt completion, set |completion| to
+        |callResult| and jump to the step labeled <a href="#construct-return"><i>return</i></a>.
+    1.  Set |completion| to the result of [=converted to an IDL value|converting=]
+        |callResult|.\[[Value]] to an IDL value of the same type as the operation’s
+        return type.
+    1.  <i id="construct-return">Return:</i> at this
+        point |completion| will be set to an ECMAScript completion value.
+        1.  [=Clean up after running a callback=] with |stored settings|.
+        1.  [=Clean up after running script=] with |relevant settings|.
+        1.  Return |completion|.

This is a preexisting "problem" that ideally I'd like to not fix in this PR.

Personally I think it is OK for specs to treat returning completion values and traditional return/throw flow the same way, without an explicit conversion step. (And similarly, treating return/flow throw as returning completion values.) It's a bit strange that the ES completion record holds a Web IDL value, but IMO fine.

-- 
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/328#discussion_r107835283

Received on Friday, 24 March 2017 05:00:49 UTC