Delaying execution of modules in the loader

Ian Hickson ian at hixie.ch
Tue Aug 19 16:46:09 PDT 2014


On Tue, 19 Aug 2014, Guy Bedford wrote:
>
> The loader is designed to enable deferred execution, but there isn't an 
> easy hook to allow this that I know of.
> 
> System.define is the only load function that does not ensure execution. 
> The others (System.import, System.load, System.module), run an 
> EnsureEvaluated call to run the scripts.
> 
> It could certainly be worth considering a new load function that runs 
> the hook cycles but does not evaluate - System.preload for example. The 
> implementation is trivial as well.

Oh, interesting. You mean that just calling LoadModule() doesn't actually 
trigger any code to execute? That would solve my problem, I just wouldn't 
call EnsureEvaluated() until I needed the modules.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'


More information about the es-discuss mailing list