But I still don't see any error in the main point of my previous mail, that is that only two different sets of globals are needed.
No... that's wrong.
Haha I have seriously spent since I read your last mail (40mins) to try to understand that, but I finally think I do. Bummer.
It just doesn't feel good to have to resort to things with such great conceptual and performance overhead. How many levels are really used in practise, assuming that Gambit core can somehow be hacked away from this limitation? I don't think I've ever seen a macro that uses complex macro expansion in itself, let alone more levels. If interpretation with a cache with macro-expanded code for each used level is used mostly, wouldn't that work rather well? I can see libraries like srfi-1 needing to be instansiated at levels 1, 2 and maybe 3 but that's an extreme case. For these libraries it might be possible to add a declaration that states that multiple instances of this module is not required?
A more impure approach might be to require modules that require multiple instances to declare that explicitly. As I understand it most modules don't carry any state at all, and in these cases this isn't an issue. (With state I mean anything that isn't constant or isn't the same for every invocation of the module)
/Per