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

call-next-method



Is it really correct if a compiler warns in the following code

(defclass test ()
  ()
  )

(defmethod testmethod ((ich test) foo)
  (print foo))

(defclass test-1 (test)
  ())

(defmethod testmethod ((ich test-1) foo)
  (call-next-method))

(testmethod (make-instance 'test-1) 4)

with 
;Compiler warnings :
;   Unused lexical variable Foo, in Testmethod.

since foo is actually used in testmethod ((ich test) foo)
because of the call-next-method?

My problem is that Macintosh Common Lisp 2.0 warns but
Allegro Cl/PC 1.0 does not and I have to exchange code
between the two platforms. Even worse, if I change
 testmethod ((ich test-1) foo) to

(defmethod testmethod ((ich test-1) foo)
  (declare (ignore foo))
  (call-next-method))

Macintosh Common Lisp 2.0 is satisfied but Allegro Cl/PC 1.0
complains that foo is actually used and not ignored, so I have to write

(defmethod testmethod ((ich test-1) foo)
  #+:ccl-2 (declare (ignore foo))
  (call-next-method))

what is quite annoying, since this code is really not platform-dependent

Karsten

Karsten Poeck
Universitaet  Wuerzburg
Lehrstuhl fuer Informatik VI