As Clon
evolves over time, you might one day feel the need for
conditionalizing your code on the version of the library. While the
end-user of your application has limited means to access the current
version number of Clon
(see Clonification in The Clon End-User Manual and the
built-in option --clon-version), you, the application programmer
and Clon
user, have a finer grained access to it.
The first thing you can do to access the current version number of
Clon
is use the version
function (this is in fact the function
bound to the --clon-version option).
Return the current version number of Clon
. TYPE can be one of
:number
, :short
or :long
. For :number
, the
returned value is a fixnum. Otherwise, it is a string.
A Clon
version is characterized by 4 elements as described below.
*release-major-level*
.
*release-minor-level*
.
*release-status*
. The
status of a release can be :alpha
, :beta
, :rc
(standing for “release candidate”) or :patchlevel
. These are in
effect 4 levels of expected stability.
*release-status-level*
. Status levels start at 1 (alpha 1, beta 1
and release candidate 1) except for stable versions, in which case patch
levels start at 0 (e.g. 2.4.0).
In addition to that, each version of Clon
(in the sense
major.minor, regardless of the status) has a name, stored in the
parameter *release-name*
. The general naming theme for Clon
is
“Great Jazz Musicians”. Anyone daring to mention Kenny G at that point
will be shot on sight.
Here is how the version
function computes its value.
:number
is computed as major . 10000 + minor .
100 + patchlevel, effectively leaving two digits for each level. Note
that alpha, beta and release candidate status are ignored in version
numbers (this is as if the corresponding status level was considered to
be always 0). Only stable releases have their level taken into account.
:short
version will appear like this for unstable releases:
1.3a4, 2.5b8 or 4.2rc1. Remember that alpha, beta or release candidate
levels start at 1. Patchlevels for stable releases start at 0 but 0 is
ignored in the output. So for instance, version 4.3.2 will appear as-is,
while version 1.3.0 will appear as just 1.3.
:long
version is expanded from the short one, and includes the
release name. For instance, 1.3 alpha 4 "Bill Evans", 2.5 beta 8 "Scott
Henderson", 4.2 release candidate 1 "Herbie Hancock" or 4.3.2 "Chick
Corea". As for the short version, a patchlevel of 0 is ignored in the
output: 1.3 "Bill Evans".
Incidentally, but you will probably never need to use it, Clon
also
exports a variable named *copyright-years*
, which, as its name
suggests, is a string denoting the copyright years for the whole
project.