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

Correct to ignore params to :around methods?

I use :around methods to bind special variables and then
call call-next-method with no parameters.

This works, but causes compiler warnings for each non-
specialized parameter.

I can get rid of the warnings by declaring to ignore 
the parameters, but I feel uncomfortable doing that since 
the parameters are in fact "used" by the method called 
by call-next-method. Ignoring them works, but would it 
work if my declaration were trusted?

What is the correct way to handle this? 
Thanks for any assistance.

Oddmund Mogedal

Here is an example:

(defvar *test* 0)

(defclass test-class ()
  ((first-slot :accessor first-slot)))

; a perfectly useless method, but that isn't the point
(defmethod set-first-slot ((obj test-class) 
  (setf (first-slot obj) 
        (+ *test* new-value)))

(defclass test-class-sub (test-class)

;Evaluating the :around method below causes the
;following compiler warning:
;Compiler warnings :
;   Unused lexical variable NEW-VALUE, in SET-FIRST-SLOT.
(defmethod set-first-slot :around ((obj test-class-sub) 
  (let ((*test* 24))

;The following version gets rid of the warning, but is it
;correct (i.e. would it be correct if my declaration were
(defmethod set-first-slot :around ((obj test-class-sub) 
  (declare (ignore new-value))
  (let ((*test* 24))