Module Execution Order

Sam Tobin-Hochstadt samth at ccs.neu.edu
Wed Apr 10 07:50:29 PDT 2013


On Wed, Apr 10, 2013 at 10:46 AM, Kevin Smith <zenparsing at gmail.com> wrote:
>
>> > 2)  The execution order is then just a topological sort of the
>> > dependency
>> > graph, breaking cycles where appropriate.  Is that correct?
>>
>> Yes.  Cycles are broken by reference to the order in which the
>> relevant imports appear in the source of the importing module.
>
> Mmmm...
>
> In that case, I believe we can use nested (lexical) modules for
> concatenation, and my previous critique doesn't hold.  To bundle some root
> module R, we create a topological sort of R's dependencies, assign a unique
> identifier to each dependency, and replace occurrences of module specifier
> strings with the appropriate module identifier.

I'm not sure what prior critique you're referring to.  Also, we no
longer plan to include nested modules in ES6.  Also^2, concatenation
should simply require literally concatenating the modules, with
`module "NAME" { ... }` wrappers with appropriate names based on the
file system (in the common case where development occurs in multiple
node-style files).

Sam


More information about the es-discuss mailing list