Next: , Previous: , Up: The Library System   [Contents][Index]

1.1 Feature

SLIB denotes features by symbols. SLIB maintains a list of features supported by a Scheme session. The set of features provided by a session may change during that session. Some features are properties of the Scheme implementation being used. The following intrinsic features detail what sort of numbers are available from an implementation:

SLIB initialization (in require.scm) tests and provides any of these numeric features which are appropriate.

Other features correspond to the presence of packages of Scheme procedures or syntax (macros).

Function: provided? feature

Returns #t if feature is present in the current Scheme session; otherwise #f. More specifically, provided? returns #t if the symbol feature is the software-type, the scheme-implementation-type 1, or if feature has been provided by a module already loaded; and #f otherwise.

In some implementations provided? tests whether a module has been required by any module or in any thread; other implementations will have provided? reflect only the modules required by that particular session or thread.

To work portably in both scenarios, use provided? only to test whether intrinsic properties (like those above) are present.

The feature argument can also be an expression calling and, or, and not of features. The boolean result of the logical question asked by feature is returned.

The generalization of provided? for arbitrary features and catalog is feature-eval:

Function: feature-eval expression provided?

Evaluates and, or, and not forms in expression, using the values returned by calling provided? on the leaf symbols. feature-eval returns the boolean result of the logical combinations.

Procedure: provide feature

Informs SLIB that feature is supported in this session.

(provided? 'foo)    ⇒ #f
(provide 'foo)
(provided? 'foo)    ⇒ #t

Footnotes

(1)

scheme-implementation-type is the name symbol of the running Scheme implementation (RScheme, |STk|, Bigloo, chez, Elk, gambit, gauche, guile, JScheme, kawa, MacScheme, MITScheme, Pocket-Scheme, S7, Scheme48, Scheme->C, Scheme48, Scsh, SISC, T, umb-scheme, or Vscm). Dependence on scheme-implementation-type is almost always the wrong way to do things.


Next: , Previous: , Up: The Library System   [Contents][Index]