Suppose you have a method definer
my-defmethod
:
(defmacro my-defmethod ((name &key doc)
lambda-list
&body body)
`(defmethod ,name ,lambda-list ,@body))
Unlike function dspecs, method dspecs need to include the specialized argument types as well as the function name, so the alias and the parser both need to be more complex.
This causes the dspec to include the argument types:
(dspec:define-dspec-alias my-defmethod (name &rest options)
`(defmethod ,name ,@options))
The dspec parser for method lambda lists is complicated, but you can invoke the
defmethod
parser in your
my-defmethod
parser, like this:
(dspec:define-form-parser my-defmethod (name-stuff lambda-list)
`(,my-defmethod ,@(cdr (dspec:parse-form-dspec
`(defmethod ,(car name-stuff)
,lambda-list)))))
Now this definition can be located:
(my-defmethod (bar :doc "bar documentation") (x y)
(foo x y))
(defmethod bar (x y)
(foo x y))
LispWorks User Guide and Reference Manual - 21 Dec 2011