Previous: provide and require, Up: Modules [Contents][Index]
Scheme, as defined in R5RS, does not have a full module system. However it does define the concept of a top-level environment. Such an environment maps identifiers (symbols) to Scheme objects such as procedures and lists: About Closure. In other words, it implements a set of bindings.
Environments in R5RS can be passed as the second argument to
eval
(see Fly Evaluation). Three procedures are defined to
return environments: scheme-report-environment
,
null-environment
and interaction-environment
(see Fly Evaluation).
In addition, in Guile any module can be used as an R5RS environment,
i.e., passed as the second argument to eval
.
Note: the following two procedures are available only when the
(ice-9 r5rs)
module is loaded:
(use-modules (ice-9 r5rs))
version must be the exact integer ‘5’, corresponding to revision
5 of the Scheme report (the Revised^5 Report on Scheme).
scheme-report-environment
returns a specifier for an
environment that is empty except for all bindings defined in the
report that are either required or both optional and supported by the
implementation. null-environment
returns a specifier for an
environment that is empty except for the (syntactic) bindings for all
syntactic keywords defined in the report that are either required or
both optional and supported by the implementation.
Currently Guile does not support values of version for other revisions of the report.
The effect of assigning (through the use of eval
) a variable
bound in a scheme-report-environment
(for example car
)
is unspecified. Currently the environments specified by
scheme-report-environment
are not immutable in Guile.
Previous: provide and require, Up: Modules [Contents][Index]