A feature is an aspect or attribute of Common Lisp, of the implementation, or of the environment. A feature is identified by a symbol.
A feature is said to be present in a Lisp image
if and only if the symbol naming it is an element of the
list held by the variable *features*
,
which is called the features list.
Boolean combinations of features, called
feature expressions,
are used by the #+
and #-
reader macros in order to
direct conditional reading of expressions by the Lisp reader.
The rules for interpreting a feature expression are as follows:
If a symbol naming a feature is used as a feature expression,
the feature expression succeeds if that feature is present;
otherwise it fails.
(not
feature-conditional)
A not feature expression succeeds
if its argument feature-conditional fails;
otherwise, it succeeds.
(and
{feature-conditional
}*)
An and feature expression succeeds
if all of its argument feature-conditionals succeed;
otherwise, it fails.
(or
{feature-conditional
}*)
An or feature expression succeeds if any of its argument feature-conditionals succeed; otherwise, it fails.
For example, suppose that
in implementation A, the features spice
and perq
are present,
but the feature lispm
is not present;
in implementation B, the feature lispm
is present,
but the features spice
and perq
are
not present;
and
in implementation C, none of the features spice
, lispm, or perq
are
present.
The next figure shows some sample expressions, and how they would be
read2 in these implementations.
|
Figure 24.1: Features examples