On Thu, Nov 07, 2002 at 11:27:22AM -0500, Raymond Toy wrote:
> >>>>> "Christophe" == Christophe Rhodes <csr21@...> writes:
> Christophe> Hi,
> Christophe> I think the following is a bug, but can anyone confirm?
> Christophe> * (defmethod foo (x) x)
> Christophe> STYLE-WARNING: implicitly creating new generic function FOO
> Why is there a style-warning here? Is it really bad style to create a
> method without doing a defgeneric?
Partly this is sbcl being pedantic. But partly, yes, it is, arguably. I
was looking at SBCL's user manual today, and it says:
However, these warnings should be read not as "warning, bad aesthetics
detected, you have no style" but "warning, this style keeps the
compiler from understanding the code as well as you might like." That
is, unless the compiler warns about such conditions, there's no way
for the compiler to warn about some programming errors which would
otherwise be easy to overlook.
One of the things this style warning catches is, for instance[*]
(defmethod allocate-isntance ((c my-class) &rest initargs)
which may or may not be a problem, depending on how well you type :)
[*] (semi)pun intended :-)
http://www-jcsu.jesus.cam.ac.uk/~csr21/ +44 1223 510 299/+44 7729 383 757
(set-pprint-dispatch 'number (lambda (s o) (declare (special b)) (format s b)))
(defvar b "~&Just another Lisp hacker~%") (pprint #36rJesusCollegeCambridge)