manpagez: man pages & more
info guile
Home | html | info | man
[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.19.11 Environments

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: The Concept of Closure. In other words, it implements a set of bindings.

Environments in R5RS can be passed as the second argument to eval (see section Procedures for On the Fly Evaluation). Three procedures are defined to return environments: scheme-report-environment, null-environment and interaction-environment (see section Procedures for On the 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))
Scheme Procedure: scheme-report-environment version
Scheme Procedure: null-environment version

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.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated on April 20, 2013 using texi2html 5.0.

© manpagez.com 2000-2024
Individual documents may contain additional copyright information.