ES Modules: suggestions for improvement

David Herman dherman at mozilla.com
Wed Jun 27 11:02:41 PDT 2012


On Jun 27, 2012, at 11:00 AM, Jussi Kalliokoski wrote:

> On Wed, Jun 27, 2012 at 8:43 PM, David Herman <dherman at mozilla.com> wrote:
> 
>     http://blog.safeshepherd.com/23/how-one-missing-var-ruined-our-launch/
> 
> I don't see how that's at all related to modules or how modules would have prevented this. 

Because we're talking about static checking of unbound variables within modules. A reference to or assignment to an unbound variable would result in an early error.

> For this, if it's actually that convenient, I'd actually suggest another destructuring pattern, because it might be useful in general as well:
> 
> let * = Math;

This is dynamic scoping. The difference between import * and let * is that the former is statically scoped, and the latter is dynamically scoped.

> What about exported objects then? Are they immutable to clients as well? That would make this unusable for libraries that have a plugin system, such as jQuery.

Of course not. You can export a mutable object if you want to. You can export whatever you want.

Dave

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120627/9869573b/attachment.html>


More information about the es-discuss mailing list