Re: [heycam/webidl] Make interface prototype object creation imperative (#494)

domenic requested changes on this pull request.

A few small issues, plus the unforgeable problem. Sorry for the delay in helping out here.

>  
-*   The name of the property is the [=identifier=] of the [=constant=].
-*   The location of the property is determined as follows:
-    *   If the interface was declared with the [{{Global}}] [=extended attribute=],
-        then the property exists on the single object that implements the interface.
-    *   Otherwise, if the interface has an [=interface prototype object=],
-        then the property exists on it.
-*   The value of the property is that which is obtained by [=converted to an ECMAScript value|converting=] the [=constant=]’s IDL value to an ECMAScript value.
-*   The property has attributes { \[[Writable]]: <emu-val>false</emu-val>, \[[Enumerable]]: <emu-val>true</emu-val>, \[[Configurable]]: <emu-val>false</emu-val> }.
+<div algorithm>
+    To <dfn>expose the constants</dfn> of [=interface=] |interface| on |target|,

This should take a _realm_ as an argument and pass that to _exposed_.

>  
-*   The name of the property is the [=identifier=] of the [=constant=].
-*   The location of the property is determined as follows:
-    *   If the interface was declared with the [{{Global}}] [=extended attribute=],
-        then the property exists on the single object that implements the interface.
-    *   Otherwise, if the interface has an [=interface prototype object=],
-        then the property exists on it.
-*   The value of the property is that which is obtained by [=converted to an ECMAScript value|converting=] the [=constant=]’s IDL value to an ECMAScript value.
-*   The property has attributes { \[[Writable]]: <emu-val>false</emu-val>, \[[Enumerable]]: <emu-val>true</emu-val>, \[[Configurable]]: <emu-val>false</emu-val> }.
+<div algorithm>
+    To <dfn>expose the constants</dfn> of [=interface=] |interface| on |target|,

We may want to consider a different verb like "install" instead of "expose" since "exposed" already has a meaning.

> -    *   If the attribute is a [=static attribute=],
-        then there is a single corresponding property and it exists on the interface’s [=interface object=].
-    *   Otherwise, if the attribute is [=unforgeable=] on
-        the interface or if the interface was declared with the [{{Global}}] [=extended attribute=],
-        then the property exists on every object that implements the interface.
-    *   Otherwise, the property exists solely on the interface’s [=interface prototype object=].
-*   The property has attributes { \[[Get]]: |G|, \[[Set]]: |S|, \[[Enumerable]]: <emu-val>true</emu-val>, \[[Configurable]]: |configurable| },
-    where:
-    *   |configurable| is <emu-val>false</emu-val> if the attribute was
-        declared with the [{{Unforgeable}}] extended attribute and <emu-val>true</emu-val> otherwise;
-    *   |G| is the [=attribute getter=] created given the attribute, the interface,
-        and the [=relevant Realm=] of the object that is the location of the property; and
-    *   |S| is the [=attribute setter=] created given the attribute, the interface,
-        and the [=relevant Realm=] of the object that is the location of the property.
+<div algorithm>
+    To <dfn>expose the regular attributes</dfn> of [=interface=] |interface| on |target|, given [=Realm=] |realm|, 

As above, _realm_ should be passed to "exposed" in all of these.

> -        the interface or if the interface was declared with the [{{Global}}] [=extended attribute=],
-        then the property exists on every object that implements the interface.
-    *   Otherwise, the property exists solely on the interface’s [=interface prototype object=].
-*   The property has attributes { \[[Get]]: |G|, \[[Set]]: |S|, \[[Enumerable]]: <emu-val>true</emu-val>, \[[Configurable]]: |configurable| },
-    where:
-    *   |configurable| is <emu-val>false</emu-val> if the attribute was
-        declared with the [{{Unforgeable}}] extended attribute and <emu-val>true</emu-val> otherwise;
-    *   |G| is the [=attribute getter=] created given the attribute, the interface,
-        and the [=relevant Realm=] of the object that is the location of the property; and
-    *   |S| is the [=attribute setter=] created given the attribute, the interface,
-        and the [=relevant Realm=] of the object that is the location of the property.
+<div algorithm>
+    To <dfn>expose the regular attributes</dfn> of [=interface=] |interface| on |target|, given [=Realm=] |realm|, 
+    run the following steps:
+
+    1.  Let |attribues| be the [=list=] of [=exposed=] [=regular attributes=] that are [=members=] of |interface|.

Typo "attribues" (missing t) in multiple places

> +    run the following steps:
+
+    1.  Let |attribues| be the [=list=] of [=exposed=] [=regular attributes=] that are [=members=] of |interface|.
+    1.  [=list/Remove=] from |attribues| all the [=attribues=] that are [=unforgeable=].
+    1.  [=Expose the attributes=] |attributes| of |interface| on |target| given |realm|.
+</div>
+
+<div algorithm>
+    To <dfn>expose the static attributes</dfn> of [=interface=] |interface| on |target|, given [=Realm=] |realm|, 
+    run the following steps:
+
+    1.  Let |attribues| be the [=list=] of [=exposed=] [=static attributes=] that are [=members=] of |interface|.
+    1.  [=Expose the attributes=] |attributes| of |interface| on |target| given |realm|.
+</div>
+
+<div algorithm>

This seems to be unused. I guess it could be done in the constructor ("interface object").

> +            \[[Configurable]]: <emu-val>true</emu-val>}.
+        1.  Perform [=!=] <a abstract-op>DefinePropertyOrThrow</a>(|interfaceProtoObj|, {{@@unscopables}}, |desc|).
+        1.  [=list/For each=] [=exposed=] [=member=] |member| of |interface|
+            that is declared with the [{{Unscopable}}] [=extended attribute=]:
+            1.  Let |id| be |member|'s [=identifier=].
+            1.  Perform [=!=] <a abstract-op>CreateDataProperty</a>(|unscopableObject|, |id|,
+                <emu-val>true</emu-val>).
+    1.  [=Expose the regular attributes=] of |interface| on |interfaceProtoObj| given |realm|.
+    1.  [=list/For each=] [=exposed=] [=regular operation=] |op| that is a [=member=] of |interface|:
+        1.  Let |method| be the result of [=creating an operation function|creating an operation function=]
+            given |op|, |interface|, and |realm|.
+        1.  Let |modifiable| be <emu-val>false</emu-val> if |op| is [=unforgeable=]
+            and <emu-val>true</emu-val> otherwise.
+        1.  Let |desc| be the PropertyDescriptor{\[[Value]]: |method|,
+            \[[Writable]]: |modifiable|, \[[Enumerable]]: <emu-val>true</emu-val>,
+            \[[Configurable]]: |modifiable|}.

This isn't correct for unforgeable operations :(. Those need to be on each instance, so putting them on the prototype is not right. They could be done in the constructor, i.e. https://heycam.github.io/webidl/#interface-object

-- 
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/494#pullrequestreview-84572400

Received on Tuesday, 19 December 2017 21:59:36 UTC