mbeckem / tiro

A simple scripting language.
MIT License
7 stars 0 forks source link

Eager module initialization on application startup #15

Open mbeckem opened 3 years ago

mbeckem commented 3 years ago

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