Re: [heycam/webidl] Add an algorithm to create a platform object. (#635)

domenic commented on this pull request.

Almost there, woohoo.

> @@ -12346,12 +12363,60 @@ It is the responsibility of specifications using Web IDL to state
 which global environment (or, by proxy, which global object) each platform
 object is associated with.
 
+<div algorithm>
+  To create a <dfn export>new</dfn> object implementing the interface |interface|, with a Realm
+  |realm|, perform the following steps:
+
+    1.  Return the result of creating a [=new-internal|new=] object implementing |interface|, with
+        |realm| and no target.
+</div>
+
+<div algorithm>
+  To create a <dfn lt=new-internal>new</dfn> object implementing the interface |interface|, with
+  a Realm |realm| and optionally a target |newTarget|, perform the following steps:

```suggestion
  a Realm |realm| and optionally a JavaScript function value |newTarget|, perform the following steps:
```

> @@ -13324,10 +13369,8 @@ Each {{DOMException}} object has an associated <dfn for="DOMException">name</dfn
 The <dfn constructor for="DOMException"><code>DOMException(|message|, |name|)</code></dfn>
 constructor, when invoked, must run these steps:
 
-1. Let |e| be a new {{DOMException}} object.
-1. Set |e|'s [=DOMException/name=] to |name|.
-1. Set |e|'s [=DOMException/message=] to |message|.
-1. Return |e|.
+1. Set <emu-val>this</emu-val>'s [=DOMException/name=] to |name|.

Technically "this" is not really defined that well; that's https://www.w3.org/Bugs/Public/show_bug.cgi?id=27301. However I support landing this as-is and as a follow-up working on that additional rigorization project. The text you have that says "as the this value" is pretty good for now.

In particular I think we'd want to define "this value" or "this" as something linkable, for both methods and constructors, and encourage a typography that either leaves it un-marked-up or cross-links to the Web IDL definition.

> @@ -10699,11 +10714,13 @@ the <code>typeof</code> operator will return "function" when applied to an inter
         1.  Let &lt;|constructor|, |values|&gt; be the result
             of passing |S| and |args|.
             to the [=overload resolution algorithm=].
-        1.  Let |R| be the result of performing
-            the actions listed in the description of |constructor|
-            with |values| as the argument values.
+        1.  Let |object| be a [=new-internal|new=] object implementing |I|, with |realm| and

Per my unrolling at https://github.com/heycam/webidl/pull/635#discussion_r254879231, it looks like we should use GetFunctionRealm(NewTarget), not _realm_, to match ES.

-- 
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/635#pullrequestreview-202868352

Received on Tuesday, 12 February 2019 19:47:39 UTC