Minor questions on new module BNF

Domenic Denicola domenic at domenicdenicola.com
Mon Jun 3 00:24:13 PDT 2013

From: samth0 at gmail.com [mailto:samth0 at gmail.com] On Behalf Of Sam Tobin-Hochstadt

> The idea here is that modules will typically be written in files like "compiler/Lexer.js", where the starting grammar production *is* `ModuleBody`.

Ah, that makes sense! It's a nice way of prohibiting `<script>export function foo() { }</script>` as well, assuming inline `<script>` corresponds to `Script`. It would be helpful to update the wiki with this, or more generally to show how this grammar will integrate with the rest of the grammar.

> I would just write `import {} from "someModule";`

That appears to be disallowed; I believe

    "{" ImportSpecifier ("," ImportSpecifier)* ","? "}"

requires at least one `ImportSpecifier`. (It's also sad and ugly; any reason not to allow `import "someModule";`?)

More information about the es-discuss mailing list