Hi. Following some brainstorming with Christian Jaeger, Jérémie Lasalle-Ratelle, and Bradley Lucier last week I have returned to thinking about runtime system extensions that would be useful for modular programming.
Concurrently Guillaume Cartier was working on improving the startup time of Jedi. Guillaume expressed the need to statically link some of the modules of the Jazz system into the executable (to avoid the startup delay caused by accessing the filesystem for many small modules). He would like the modules to be linked into the executable, but *not initialized*. Instead the modules should only be initialized if and when they are actually used by the application.
One of the things that we (excluding Guillaume) did during the brainstorming was to look into some Chicken eggs to see how they are organized, and how they could be used within Gambit with little or no changes to the egg source code. It turns out that Gambit's namespace system provides most of what is needed (although the FFI may need small extensions for some eggs).
One thing that came up was the need to ensure that a module would be loaded at most once. This is because a given module may be required by multiple modules that are required by the main module/program. For example the main module A may require modules B and C, and both B and C require module D. Simply putting a (load "D") at the top of B and C will end up loading "D" twice. During our brainstorming I proposed a "load-once" procedure which would maintain a table of the previously loaded modules so that a module would only be loaded once. There are two issues with this:
1) How are modules identified? In other words what is the key that is used to access the previously loaded module table? One simple approach would be to use the filename as the key, but this does not work in a static linking model where the modules have been linked with the executable (and the executable is meant to be installed on a different machine). So what is a good way to identify modules unambiguously? A hash? A user supplied "module id"? Should modules have version numbers?
2) For interactive development there is a need to force the loading of modules, even if they have been loaded already. How should this be expressed by the user?
If you have some thoughts about these issues please tell!
Marc