To test availability of a SRFI with cond-expand
(see Feature conditional), you can use (library library-name)
feature requirement. You can use both Gauche-style and R7RS-style
library name notation.
;; Use 'library' feature requirement with Gauche module name (cond-expand [(library srfi.13) (use srfi.13) ...] [else ...]) ;; Use 'library' feature requirement with R7RS library name (cond-expand [(library (srfi 13)) (import (srfi 13)) ...] [else ...])
Alternatively you can use a SRFI name as a feature identifier.
This use is deprecated. This is an old style used before R7RS.
With this style, if the feature is fulfilled, the necessary libraries
are implicitly imported, so you don’t need to have use
or
import
forms (but that means you can’t control the imports
with only
, rename
, prefix
etc.)
;; DEPRECATED. Use 'srfi-N' feature identifier. ;; If the feature is fulfilled, you can assume the module is already 'use'd. (cond-expand [srfi-13 ...] [else ...])
If srfi-N
is used as a feature identifier, a warning is
issued when an environment variable GAUCHE_WARN_SRFI_FEATURE_ID
is
set. In future this warning will be the default. We urge the users
to update their code to use (library srfi.N)
form.