[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

DEFMETHOD automagic references considered random



Can someone please explain to me the reason why specialized arguments are
automagically referenced in the bodies of methods?  Yes, I know that
DEFMETHOD is documented to do this; my real question is why this is so.

For example,

  (defmethod adopt ((parent basic-node) (child parentless-mixin))
    (error "Attempt to adopt ~S, a parentless child" child))

does not warn that PARENT is an unused variable, and

  (defmethod adopt ((parent basic-node) (child parentless-mixin))
    (declare (ignore parent))
    (error "Attempt to adopt ~S, a parentless child" child))

DOES warn that PARENT is used after being declared IGNOREd.  It seems to
me that this violates a principle of the IGNORE declaration, namely that
specific textual references in the body should be what counts for
"references".

[Of course, by the same reasoning, 

  (dotimes (i n)
    (declare (ignore i))
    (do-something-which-does-not-use-I))

should also be correct, but most implementations warn about the hidden uses
of the variable I.]