Standard modules - concept or concrete?

Sam Tobin-Hochstadt samth at ccs.neu.edu
Sat Jun 8 11:38:09 PDT 2013


On Sat, Jun 8, 2013 at 2:30 PM, Brian Di Palma <offler at gmail.com> wrote:
> On Sat, Jun 8, 2013 at 7:07 PM, Sam Tobin-Hochstadt <samth at ccs.neu.edu> wrote:
>>
>> I think you misunderstand.  The requirement that modules not have free
>> variables at compile time *includes* global references. I expect that
>> development environments won't have a problem handling this or
>> enforcing whatever properties you're looking for.
>
> I think I see what you're saying. Let me just see if I'm correct.
>
> At compile time any references in a module which are not explicitly
> imported but are language globals will not cause compile errors.
> Any references which aren't explicitly imported and aren't language
> globals will cause a compile error?

This is close, but not quite right.  The rule is that any unbound
variables in modules are errors.  The variables may be bound by import
declarations, or by lexical bindings such as `var` or `let`, or by
bindings on the global object, or by top-level `let` bindings (which
are not on the global object, IIRC).

Sam


More information about the es-discuss mailing list