> Allowing a callable module would go a long way towards bridging the > gap with "settings exports" as that is the primary use of that > feature, although it has been useful for text plugins to set the value > of an AMD module to a text string (see loader plugins section).
I'll try to think up some lightweight ways to make a module callable. > In that case, I can see the appeal for what Dmitry mentions in his > reply, just reducing it to: > > module thing = "some/thing"; That's been one of the alternative surface syntaxen we've considered. As I said to Dmitry, let's avoid bikeshedding on-list. > Ideally, you could have multiple ones with one module word: > > module datePicker = "datePicker", > thing = "some/thing", > Q = "Q"; This is actually already part of the proposal. >> BTW, what you're asking for is essentially a concurrent join, which is >> convenient to express in a new library I'm working on called jsTask: >> >> let [m1, m2, m3] = yield join(load("m1.js"), load("m2.js"), >> load("m3.js")); > > I like the ideas behind jsTask, although I would rather not type load that > much: > > let [m1, m2, m3] = yield load(["m1.js", "m2.js", "m3.js"]); Sure, and that's easy enough to implement. You could even simplify it further by making load variable-arity: let [m1, m2, m3] = yield load("m1.js", "m2.js", "m3.js"); > Array of modules via require([], function (){}) has been useful in > RequireJS, and has a nice parity with the define([], function (){}) > dependency list too, although not applicable here. Fair enough if you > want to consider sugar later. Yeah, we'll get there. This is something I feel pretty confident can be made convenient without affecting the core of the system, so I think it can wait till later. Thanks again for your input, Dave _______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss