ES Modules: suggestions for improvement

David Bruant bruant.d at
Wed Jun 27 02:04:44 PDT 2012

Le 27/06/2012 10:31, Brendan Eich a écrit :
> David Bruant wrote:
>> Le 26/06/2012 16:44, David Bruant a écrit :
>>> Also relevant to this thread, post on the same topic by Isaacs 
>>> (node.js lead) :
>> "Furthermore, |let| already gives us destructuring assignment. If a 
>> module exports a bunch of items, and we want several of them, then do 
>> |var {x,y,z} = import 'foo'| or some such."
>> => Excellent idea. That combined with the single export idea reduces 
>> the amount of new syntax to introduce.
> Declarations can nest under control flow constructs, but import or 
> module dependencies must be prefetched. They're static.
>   if (some_rare_condition()) { let x = import "m"; ... }
> either always prefetches "m", which does not say what is meant;
It could be considered to allow 'let x = import "m";' only at the top level.
But if it's the case, having a specific lexical form makes clearer that 
it's a module import and not a regular assignment.

> or it nests an event loop, violating run-to-completion, which is not 
> going to happen.
Event loops and run-to-completion aren't even part of ECMAScript, so I 
wouldn't allow myself to think about such a thing.
Also having played with nested event loops in Firefox chrome code, I'm 
not really sure they're a good idea the way they are currently designed 
at least.


More information about the es-discuss mailing list