Guile’s module system includes support for locating modules based on
a declared version specifier of the same form as the one described in
R6RS (see R6RS Library Form in The Revised^6
Report on the Algorithmic Language Scheme). By using the
#:version
keyword in a define-module
form, a module may
specify a version as a list of zero or more exact, non-negative integers.
This version can then be used to locate the module during the module
search process. Client modules and callers of the use-modules
function may specify constraints on the versions of target modules by
providing a version reference, which has one of the following
forms:
(sub-version-reference ...) (and version-reference ...) (or version-reference ...) (not version-reference)
in which sub-version-reference is in turn one of:
(sub-version) (>= sub-version) (<= sub-version) (and sub-version-reference ...) (or sub-version-reference ...) (not sub-version-reference)
in which sub-version is an exact, non-negative integer as above. A version reference matches a declared module version if each element of the version reference matches a corresponding element of the module version, according to the following rules:
and
sub-form matches a version or version element if every
element in the tail of the sub-form matches the specified version or
version element.
or
sub-form matches a version or version element if any
element in the tail of the sub-form matches the specified version or
version element.
not
sub-form matches a version or version element if the tail
of the sub-form does not match the version or version element.
>=
sub-form matches a version element if the element is
greater than or equal to the sub-version in the tail of the
sub-form.
<=
sub-form matches a version element if the version is less
than or equal to the sub-version in the tail of the sub-form.
For example, a module declared as:
(define-module (mylib mymodule) #:version (1 2 0))
would be successfully loaded by any of the following use-modules
expressions:
(use-modules ((mylib mymodule) #:version (1 2 (>= 0)))) (use-modules ((mylib mymodule) #:version (or (1 2 0) (1 2 1)))) (use-modules ((mylib mymodule) #:version ((and (>= 1) (not 2)) 2 0)))