Re: [heycam/webidl] Add [InNamespace] to allow defining an interface in a namespace (#425)

domenic commented on this pull request.

A number of nits, but overall this seems good.

I'm on the fence as to whether we should add some sort of usage note, along the lines of "most places in the platform don't do this; maybe check first, and don't go crazy using it everywhere."

> @@ -8440,6 +8440,48 @@ corresponding to [=interface members=].
 </div>
 
 
+<h4 id="InNamespace" extended-attribute lt="InNamespace">[InNamespace]</h4>
+
+If the [{{InNamespace}}] [=extended attribute=] appears on an [=interface=], it indicates that
+the [=interface object=] for this interface will not be created as a property of the global
+object, but rather the namespace which is the argument to the extended attribute.

"but rather as a property of" is clearer, I think

"namespace identified by the argument", I think

`[=namespace=]`

> +the [=interface object=] for this interface will not be created as a property of the global
+object, but rather the namespace which is the argument to the extended attribute.
+
+The [{{InNamespace}}] extended attribute [=takes an identifier|take an identifier=].
+This identifier must be the identifier of a namespace.
+
+The [{{InNamespace}}] and [{{NoInterfaceObject}}]
+extended attributes must not be specified on the same interface.
+
+The [{{InNamespace}}] extended attribute
+must not be used on a [=callback interface=].
+
+The [=class string=] of an interface with the [{{InNamespace}}] extended
+attribute is the concatenation of the class string of the namespace, <code>"."</code>,
+and the class string that the interface would otherwise have without this
+extended attribute.

I think this should not be located here but instead be a modification to

> The class string of a platform object that implements one or more interfaces must be the identifier of the primary interface of the platform object.

Also, no `<code>` around strings in Web IDL, it appears.

> @@ -12516,6 +12558,10 @@ The characteristics of a namespace object are described in [[#namespace-object]]
         1.  Let |F| be the result of [=creating an operation function|creating an operation function=]
             given |op|, |namespace|,  and |realm|.
         1.  Perform [=!=] [=CreateDataProperty=](|namespaceObject|, |op|'s [=identifier=], |F|).
+    1.  For each [=exposed=] [=interface=] |intr| which has the [{{InNamespace}}] extended attribute, with the identifier of this namespace as its argument,

Wrap to 100 chars here too

`[=identifier=]`

Just _interface_ instead of _intr_ is nicer, I think.

No comma before "with", I think.

> @@ -12516,6 +12558,10 @@ The characteristics of a namespace object are described in [[#namespace-object]]
         1.  Let |F| be the result of [=creating an operation function|creating an operation function=]
             given |op|, |namespace|,  and |realm|.
         1.  Perform [=!=] [=CreateDataProperty=](|namespaceObject|, |op|'s [=identifier=], |F|).
+    1.  For each [=exposed=] [=interface=] |intr| which has the [{{InNamespace}}] extended attribute, with the identifier of this namespace as its argument,
+        1.  Let |I| be the [=interface object=] for |intr|.
+        1.  Let |newDesc| be the PropertyDescriptor{ \[[Writable]]: <emu-val>true</emu-val>, \[[Enumerable]]: <emu-val>false</emu-val>, \[[Configurable]]: <emu-val>true</emu-val>, \[[Value]]: |I| }.

It looks like at this point we don't put spaces after { and before } in Web IDL.

-- 
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/425#pullrequestreview-58474200

Received on Thursday, 24 August 2017 19:05:23 UTC