Modules: compile time linking (was Re: Modules feedback, proposal)

Sam Tobin-Hochstadt samth at
Fri Apr 6 04:54:54 PDT 2012

On Thu, Apr 5, 2012 at 11:23 PM, John J Barton
<johnjbarton at> wrote:
> On Thu, Apr 5, 2012 at 10:01 AM, James Burke <jrburke at> wrote:
>> So, assuming Math has no dependencies (just to make this shorter), the
>> sequence of events:
>> * Load Foo, convert to AST, find "from" usage.
>> * Load Math
>> * Compile Math
>> * Evaluate Math
>> * Inspect Math's exported module value for properties
>> * Modify the compiled structure for Foo to convert "import *" to have
>> local variables for all of Math's properties that are known, only at
>> this time (no funny dynamic 'with' stuff)
>> * Evaluate Foo
> This is certainly the events I expect: is there an alternative? I suppose
> the module syntax could support moving Evaluate Math to just before Evaluate
> Foo. (a la a compiled language) The Math-level operations that created Math
> properties would not be known to Foo. That would be a major surprise to devs
> I think.

The properties available to `Foo` are exactly the ones declared with
`export` in `Math`.   I don't think that should be a surprise to
anyone -- that's what `export` is for.

However, it is the case that the evaluation of `Math` and of `Foo`
happen close together, even thought that doesn't make a difference in
this case.  It would potentially make a difference if there was some
third module that imported from `Foo`.
sam th
samth at

More information about the es-discuss mailing list