I want to make sure I understand how 'load' works in Gambit. I have basic build system using a slightly modified version Snow up and running, and I'm making a few assertions that I want to make sure are true.
In Gambit, a 'load' and 'include' are obviously quite different because it's using machine-compiled code for compiled objects, not bytecode. I have heard (I have not tested this yet, although I will soon) that it's quite expensive to call code across module boundaries, which makes reasonable sense because it cannot simply use the 'goto'-style jump. So, for any high-performance application, you want to inline code when compiling if you don't need a shared library.
Now, I have my system separated into a few shared libraries (.o1 files), but there are cases when I want to inline code that is common between them. For example, I have a utilities package which is called quite often in all of the modules, and it makes sense to include this file rather than load it (for performance). However, doing so would include this file in all modules, so when the modules are loaded together, the same symbols are redefined.
If code is of the form
(load "lib") (include "util.scm")
(call-utility-function 'with 'some 'params)
and util.scm is also included in the "lib" library, is it same to assume that when the above code is compiled in Gambit that call-utility-function with resolve to the local version with a 'goto'-style jump? I don't see how it wouldn't since it has no idea about lib's version of call-utility-function until run-time, unless it does some sort of check at runtime? I know you can't redefine symbols in Gambit at compile-time, so I'm assuming it does a sort of static binding.
I'll be the first to admit that this may be a major case of pre-optimization. so slap me if I shouldn't be worrying about this as much.