The current implementation of module loading is lazy, i.e. the module initializer is executed when a module is imported for the first time.
Initialization should be eager instead, with an explicit start() call once all modules have been registered with the vm.
This would ensure an application finishes initialization correctly and does not error out unexpectedly on, for example, the first request.
Pseudocode:
vm.register_module("a", ...);
vm.register_module("b", ...);
vm.start(callback); // init all modules in the dependency graph, respecting module dependencies
The current implementation of module loading is lazy, i.e. the module initializer is executed when a module is imported for the first time. Initialization should be eager instead, with an explicit
start()
call once all modules have been registered with the vm. This would ensure an application finishes initialization correctly and does not error out unexpectedly on, for example, the first request.Pseudocode: