Re: [heycam/webidl] Define Web IDL Modules (#675)

littledan commented on this pull request.



> +        1.  Append the [=identifier=] of |member| to |exports|.
+    1.  Let |moduleRecord| be [=!=] [=CreateSyntheticModule=](|exports|, the following steps,
+        |realm|, undefined), with the following steps:
+        1.  [=list/For each=] |member| of |module|'s [=module/module members|members=]:
+            1.  Let |id| be |member|'s [=identifier=].
+            1.  If |member| is an [=interface=]:
+                1.  Let |interfaceObject| be the result of [=create an interface object|creating
+                    an interface object=] for |member| with |id| in |realm|.
+                1.  Perform [=!=] [=SetSyntheticModuleExport=](|moduleRecord|, |id|,
+                    |interfaceObject|).
+            1.  Otherwise, if |member| is an [=operation=]:
+                1.  Let |method| be the result of [=creating an operation function=] given
+                    |member|, |module|, and |realm|.
+                1.  Perform [=!=] [=SetSyntheticModuleExport=](|moduleRecord|, |id|, |method|).
+            1.  Otherwise:
+                1.  Assert: |member| is an [=attribute=] or a [=partial interface=].

I don't think there's a real issue here; I think we should continue supporting partial interfaces in modules. For a use case, imagine if the Temporal proposal defined `CivilDate` in ECMA-262, in a built-in module, and then defined `CivilDate.prototype.toLocaleString` in ECMA-402 -- it would make sense to define the `toLocaleString` method in a partial interface inside a partial module. (We currently use a weirder system for Intl, where one spec has one toLocaleString definition, and the other overrides it, but I think this is even messier.)

I think we're concerned about this for the wrong reasons--this is really  more of an editorial mismatch vs the rest of the specification than an actual difficulty being faced. For example, when [defining the global property references](https://heycam.github.io/webidl/#define-the-global-property-references), there is a loop over "every non-callback interface that is exposed in realm.". That is another way of skipping partial interfaces, just less imperatively. I think the eventual fix to #432 will make it even more obvious that things work the same way between these two cases.

-- 
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/675#discussion_r272417693

Received on Friday, 5 April 2019 01:04:32 UTC