Re: [heycam/webidl] Define Synthetic Module Records (#722)

domenic approved this pull request.

LGTM with nits. I will just add a commit fixing the nits, actually.

> @@ -13244,6 +13264,162 @@ the exact steps to take if <dfn>an exception was thrown</dfn>, or by explicitly
 </div>
 
 
+<h3 id="synthetic-module-records">Synthetic module records</h3>
+
+A <dfn export>Synthetic Module Record</dfn> is used to represent information about a module that is
+defined by specifications.
+Its exports are derived from a pair of lists, of string keys and of ECMAScript values.

This sentence seems wrong; it must have been from an earlier draft I never uploaded.

> +<div algorithm>
+The abstract operation <dfn abstract-op>CreateSyntheticModule</dfn>(|exportNames|, |evaluationSteps|, |realm|, |hostDefined|) creates a [=Synthetic Module Record=] based upon
+the given exported names and evaluation steps.
+It performs the following steps:
+
+    1.  Return [=Synthetic Module Record=] {
+            \[[Realm]]: |realm|,
+            \[[Environment]]: <emu-val>undefined</emu-val>,
+            \[[Namespace]]: <emu-val>undefined</emu-val>,
+            \[[HostDefined]]: |hostDefined|,
+            \[[ExportNames]]: |exportNames|,
+            \[[EvaluationSteps]]: |evaluationSteps|
+        }.
+</div>
+
+Note: It seems we could set up the environment either here or in Instantiate().

Maybe rephrase a bit; the current note is written as more of a note to the reviewer, not to the reader. I'd do

> Note: We could set up the \[[Environment]] either here or in [=Instantiate()=]. It is done in Instantiate() for symmetry with [=Source Text Module Records=], but there is no observable difference.

> @@ -13244,6 +13264,162 @@ the exact steps to take if <dfn>an exception was thrown</dfn>, or by explicitly
 </div>
 
 
+<h3 id="synthetic-module-records">Synthetic module records</h3>
+
+A <dfn export>Synthetic Module Record</dfn> is used to represent information about a module that is
+defined by specifications.
+Its exports are derived from a pair of lists, of string keys and of ECMAScript values.
+The set of exported names is static, and determined at creation time (as an argument to
+[$CreateSyntheticModule$]), while the set of exported values can be changed over time using
+[$SetSyntheticModuleExport$].
+It has no imports or dependencies.
+
+Note: A [=Synthetic Module Record=] could be used for defining a variety of module types: for
+example, built-in modules, or JSON modules, or CSS modules.

Maybe add something like

> Note: Synthetic Module Records are being developed in concert with the authors of the <cite>JavaScript Standard Library</cite> proposal, and might eventually move to the ECMAScript specification. [[JS-STDLIB]] [[ECMA262]].

-- 
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/722#pullrequestreview-235645108

Received on Thursday, 9 May 2019 15:09:22 UTC