Sure that could be done. But then it would change the semantics of your language, in the sense that
(eval '(map sqrt '(1 4 9)))
would only "work" if somewhere else in your program you use "map" and "sqrt" *and* the compiler did not inline them (which Gambit currently does). The semantics of eval would be implementation dependent. Frankly I would find it very hard to use eval reliably.
Marc
On 4-Oct-08, at 5:39 AM, Mikael More wrote:
Does really the ability of introspection bring with it that all code is referenced to? Can't introspection work like that all routines can be introspected, that are linked in in any case?
Mikael
Afficher les réponses par date
Date: Sat, 4 Oct 2008 08:48:59 -0400 From: Marc Feeley feeley@iro.umontreal.ca
Sure that could be done. But then it would change the semantics of your language, in the sense that
(eval '(map sqrt '(1 4 9)))
would only "work" if somewhere else in your program you use "map" and "sqrt" *and* the compiler did not inline them (which Gambit currently does). The semantics of eval would be implementation dependent. Frankly I would find it very hard to use eval reliably.
The mistake here is the exposure of the `current program's global environment' implied by a unary EVAL, rather than providing access to that as a feature of the linker. The linker could have an option for explicitly reifying the linked program's global environment (or, perhaps, a collection of modules describing the program) for the use of the program; then there would be no question about whether it is safe to exclude certain bindings in the resultant executables or libraries.