The defined name of this module is
The mechanism for the conversion of an instance of one class to an instance of
another is defined by a user-extensible framework which has some similarity to
To the user, the interface to conversion is via the function
(defgeneric (converter new-class) (instance))
Hereafter, new converter methods may be defined for new-class
using a similar extended syntax for
convert, which takes an object and some class to which the
object is to be converted. The target class is used to access an associated
converter function, in fact, a generic function, which is applied to
the source instance, dispatching on its class to select the method which
implements the appropriate conversion. Thus, having defined a new class to
which it may be desirable to convert instances of other classes, the
programmer defines a generic function:
(defmethod (converter new-class)
The conversion is implemented by defining methods on the converter for
new-class which specialize on the source class. This is also how
methods are documented in this text: by an entry for a method on the
converter function for the target class. In general, the method for a given
source class is defined in the section about that class, for example, converters
from one kind of collection to another are defined in section ?? , converters
from string in section ?? , etc..
- An instance of some class to be converted to an
instance of class.
- The class to which object is to be
ResultReturns an instance of class which is equivalent in
some class-specific sense to object, which may be an instance of
any type. Calls the converter function associated with class to
carry out the conversion operation. An error is signalled (condition:
no-converter) if there is no associated function. An error is
no-applicable-method) if there is no
method to convert an instance of the class of object to an instance
condition> : <condition>
This is the general condition class for all conditions arising from conversion
- source : <object>
object to be converted into an instance of target-class.
- target-class : <class>
target class for the conversion operation.
RemarksShould be signalled by
convert or a
- The class whose set of conversion methods
ResultThe accessor returns the converter function for the class
target-class. The converter is a generic-function with methods
specialized on the class of the object to be converted.
converter) : setter function
- The class whose converter function is to be
- The new converter function.
ResultThe new converter function. The setter function replaces the
converter function for the class target-class by
generic-function. The new converter function must be an instance
RemarksConverter methods from one class to another are defined in
the section pertaining to the source class.
See also:Converter methods are defined for collections (?? ), double
float (?? ), fixed precision integer (?? ), string (?? ), symbol (?? ), vector (?? ).