william.newman@... (William Harold Newman) writes:
> Are you sure you want to do this? If you are not suppressing style
> warnings completely, I'd expect it's because you want to be warned
> about things like defining unused variables and calling undefined
> functions and so forth.
> Issuing warnings about code like
> (defgeneric suppressing-errors (family fun)
> (defmethod suppresing-errors ((family decorated-family) fun)
> (with-invoked-decorators (family)
> (funcall fun)))
> has always seemed to me to be in the same spirit, and the only thing
> the compiler will be able to see wrong about that code is that the
> the DEFMETHOD has no matching DEFGENERIC.
OK, but this special style is probably not so rarely encountered. At
least, it was mentioned also by Kent Pitman in comp.lang.lisp several
times. I usually use it in cases like this:
;;; class definition
(defclass () ...)
;;; method definitions - some of them are specializations of already
;;; existing generic functions, some of them are more for local use. At
;;; least for the moment I do not want to decide, if these should be
;;; functions or generic functions.
(defmethod ... ())
> Also, it seems to me that that's an odd thing to use DEFMETHOD for. I
> sometimes feel the need, but I meet the need with a family of
> DEFMACROs like
> (defmacro def-declaimed-fun (name (args types return-type &key inline)
> &body body))
> `(progn (declaim ...) (defun ...)))
> (defmacro def-declaimed-proc (name (args types &key inline) &body body)
> `(def-declaimed-fun ,name (,args ,types (values) :inline ,inline) ,@body))
> If you choose to use DEFMETHOD instead, you're choosing to tell the
> compiler something somewhat misleading about what you're doing; a
> roundabout way to stop the style warnings would be to choose to be
> less misleading.
The macro has the problem, that highlighting probably will not work as
well, and maybe also the editor will not be able to locate the function
definition as well, especially if something in the file has changed.