Modules, Concatenation, and Better Solutions

David Herman dherman at mozilla.com
Wed Oct 17 14:25:22 PDT 2012


On Oct 17, 2012, at 2:04 PM, Russell Leggett <russell.leggett at gmail.com> wrote:

> I'm not sure if I like how this is turning out. I think modules should either not allow side effects, or should be evaluated immediately like an IIFE. While I appreciate lazy evaluation when it is really utilized like Haskell, I think it would be very surprising here. If we need to make it easier for concatenation, maybe what we really want is an easy way to effectively prime the module loader with a sort of cache so that it only "loads" the module when needed, in the same way it would work as multiple http requests, but it never needs to go to the server.

I agree the on-demand execution is disconcerting (as I said: side-effects + laziness = trouble). And carving out a side-effect-free sub-language of JS is not going to happen, of course.

If there's a simple way to accommodate simple concatenation, possibly something along the lines of what you're talking about, it's worth considering. But it also intersects with some other possibilities that have come up both on-list and off-list. So I need to spend some time off-list thinking through the space.

Dave



More information about the es-discuss mailing list