Minor questions on new module BNF
domenic at domenicdenicola.com
Sun Jun 2 20:59:13 PDT 2013
Sam was saying that http://wiki.ecmascript.org/doku.php?id=harmony:modules is up to date. If so, I'm seeing a few things missing from the BNF. It would be great to get these clarified so people can start writing accurate transpilers.
1. It looks like `ExportDeclaration` can only occur inside `ModuleBody`, which itself can only occur as part of the named `ModuleDeclaration` production. I thought we would be able to export things without explicit named module declaration, so shouldn't `ExportDeclaration` be added to `ScriptElement`? Or perhaps to `Statement`? At http://wiki.ecmascript.org/doku.php?id=harmony:modules_examples the "compiler/Lexer.js" example contains such a situation, which seems invalid from the current grammar.
console.log("initializing subsystem 1...");
console.log("initializing subsystem 2...");
On the client side this is common for e.g. plugins:
var Backbone = require("backbone");
// now `Backbone` has been augmented with a `Backbone.LayoutView` property we can use.
I don't see any way to do this, except perhaps via
import defaultExportWillBeUndefinedSoThisBindingIsPointless from "./initSubsystem1";
import thisOneTooOhMyPoorScopeIsBeingPolluted from "./initSubsystem2";
A production of the form `"import" ModuleSpecifier ";"` would probably help this.
More information about the es-discuss