detecting JS language mode for tools

Brendan Eich brendan at
Tue Jan 28 09:32:43 PST 2014

John Lenz wrote:
> There  are three issues in my mind for tooling:
> 1) should the code be parsed as "use strict"
> 2) are "import" and "export" and "module" statements valid

Note no "module" form in ES6.

> 3) should top level declarations be considered visible outside the 
> file (no can be inferred from the presence of import or exports)
> It is my guess that it will be a common beginner mistake to load 
> modules as scripts or try to use "import" from scripts.  The first is 
> the primary one as keywords etc are different.

You could be right -- we should find out. The "mistake" has a flip-side, 
if we allow it: detection-based two-way module-scripts.


More information about the es-discuss mailing list