Date: Mon, 17 Aug 2009 09:35:04 -0400 From: Marc Feeley feeley@iro.umontreal.ca
Tree-shaking in a Lisp-like language is not easy...
> (##global-var-ref (##make-global-var (string->symbol (string-append "ev" "al")))) #<procedure #2 eval>
This is so only if one insists upon having such global databases at run-time. Nothing prevents a Scheme implementation from using other mechanisms. In Scheme48, the compiler, not the run-time system, knows about environments. You can build a system that includes the compiler and run-time system and knows about its own environments (called reifying the system), or you can build a system that includes only the run-time system, without the compiler or environments; then any unused parts of the run-time system are omitted. If you use EVAL, and also use, say, SCHEME-REPORT-ENVIRONMENT, but don't reify your own program's environments, then the compiler and only the environments containing the bindings of the RnRS are included -- no other environments need be.
An environment is a compiler data structure, not a run-time data structure -- a map from names to meanings, which for variables describe the location where the variable's value is stored at run-time. The locations can exist at run-time in the absence of the environment data structure that the compiler used. Procedures such as Gambit's ##MAKE-GLOBAL-VAR are not necessary to make Scheme work.