From: <wil...@ai...> - 2007-12-23 17:32:11
|
On Sat, Dec 22, 2007 at 10:20:55PM +0100, Nicolas Neuss wrote: > I sometimes like to use DEFMETHOD as replacement for DEFUN + type > declarations (i.e., even if there is no broader use of that function in > which case a DEFGENERIC would make sense). In these cases, the style > warning "implicitly creating new generic function" is a nuisance. Is it > possible to switch off this warning selectively? 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. 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 ...))) and (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. -- William Harold Newman <wil...@ai...> PGP key fingerprint 85 CE 1C BA 79 8D 51 8C B9 25 FB EE E0 C3 E5 7C God grant me serenity to accept the code I cannot change, courage to change the code I can, and wisdom to know the difference. -- Erik Naggum |