Next: srfi env-inquiry spec, Previous: srfi env-inquiry abstract, Up: srfi env-inquiry [Index]
The feature symbols of the R7RS–small cond-expand
syntax
provide the ability to conditionally compile code based on particular
properties of an implementation that it sees fit to publish. The
features
procedure, which returns the list of feature symbols of
the implementation, provides run–time access to the same set of
properties. Assuming that Rhinoceros Scheme provides the feature symbol
rhinoceros
but not diplodocus
and Diplodocus Scheme does
the opposite, programs can portably ask “Is this Rhinoceros Scheme or
Diplodocus Scheme?” and behave differently at run time based on the
answer. Similarly, a program can ask “Does this implementation have
exact complex numbers?” by checking for the presence of the
exact-complex
feature symbol in the result of calling
features
.
However, a program using just the features
procedure cannot
report to its user “I am executing on X Scheme” for every value of X,
because it does not know which symbol in the feature list represents the
implementation name, nor does it have a comprehensive list of
implementation names. Similarly, there are other properties that the
feature list may allow testing for but not reporting on, such as the
underlying OS and the CPU architecture. For the sake of
logging and debugging, it is necessary or at least extremely useful to
provide a standard way for Scheme applications, as well as Scheme users
at the REPL, to report these things. In the Common Lisp world, bugs
are often reported in a REPL transcript beginning with a call to
lisp-implementation-version
.