Go to the previous, next section.
The user-initial-environment
is where the top-level
read-eval-print (REP) loop evaluates expressions and stores
definitions. It is a child of the system-global-environment
,
which is where all of the Scheme system definitions are stored. All of
the bindings in 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 define
forms) occur in
user-initial-environment
.
variable+: system-global-environment
The variable system-global-environment
is bound to the
environment that's the parent of the user-initial-environment
.
Primitives and system procedures are bound (and sometimes closed) in
this environment.
variable+: user-initial-environment
The variable user-initial-environment
is bound to the default
environment in which typed expressions are evaluated by the top-level
REP loop.
Although all bindings in system-global-environment
are 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 Scheme system procedures, which
are defined in the system-global-environment
, will continue to
see the original definition.
Go to the previous, next section.