Previous: REPL Environment, Up: Environments
The operations in this section manipulate top-level environments, as opposed to environments created by the application of procedures. For historical reasons, top-level environments are referred to as interpreter environments.
Returns the current environment. This form may only be evaluated in a top-level environment. An error is signalled if it appears elsewhere.
Returns
#t
if object is an top-level environment; otherwise returns#f
.
interpreter-environment?
is an alias fortop-level-environment?
.
Returns a newly allocated top-level environment.
extend-top-level-environment
creates an environment that has parent environment,make-top-level-environment
creates an environment that has parentsystem-global-environment
, andmake-root-top-level-environment
creates an environment that has no parent.The optional arguments names and values are used to specify initial bindings in the new environment. If specified, names must be a list of symbols, and values must be a list of objects. If only names is specified, each name in names will be bound in the environment, but unassigned. If names and values are both specified, they must be the same length, and each name in names will be bound to the corresponding value in values. If neither names nor values is specified, the environment will have no initial bindings.
Defines symbol1 in environment1 to have the same binding as symbol2 in environment2, and returns an unspecified value. Prior to the call, symbol2 must be bound in environment2, but the type of binding is irrelevant; it may be a normal binding, an unassigned binding, or a keyword binding. Signals an error if symbol1 isn't definable in environment1, or if symbol2 is unbound in environment2.
By “the same binding”, we mean that the value cell is shared between the two environments. If a value is assigned to symbol1 in environment1, a subsequent reference to symbol2 in environment2 will see that value, and vice versa.