user-initial-environment is where the top-level
read-eval-print (REP) loop evaluates expressions and binds
definitions. It is a child of
is where all of the Scheme system definitions are bound. All of the
system-global-environment are available when the
current environment is
user-initial-environment. However, any
new bindings that you create in the REP loop (with
define forms or by loading files containing
system-global-environmentis bound to the distinguished environment that's the ancestor of most other environments (except for those created by
make-root-top-level-environment). It is the parent environment of
user-initial-environment. Primitives, system procedures, and most syntactic keywords are bound (and sometimes closed) in this environment.
user-initial-environmentis bound to the default environment in which typed expressions are evaluated by the top-level REP loop.
Although all bindings in
system-global-environmentare visible to the REP loop, definitions that are typed at, or loaded by, the REP loop occur in the
user-initial-environment. This is partly a safety measure: if you enter a definition that happens to have the same name as a critical system procedure, your definition will be visible only to the procedures you define in the
user-initial-environment; the MIT/GNU Scheme system procedures, which are defined in
system-global-environment, will continue to see the original definition.