I'd like to be able to use a defined type as a parameter specializer to a defmethod
. The motivation is readability and flexibility to change at a later stage. Somehting like this:
(deftype foo () 'fixnum)
(defmethod bar ((x foo)) ...)
(defmethod baz ((x foo)) ...)
However this doesn't work. CLtL2 says "The form deftype does not create any classes."
So I have to write:
(defmethod bar ((x fixnum)) ...)
(defmethod baz ((x fixnum)) ...)
An alternative would be to define a class called foo
which is nothing more than a wrapper around fixnum
but wouldn't that be an unacceptable overhead for something so simple as a fixnum
?
Is there a better way?
paramet-specializer-names
ofdefmethod
: If parameter-specializer-name is a symbol it names a class – Tiatiana