🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.lisp.mcl
Article #720

Correct to ignore params to :around methods?

#720
From: oddmund
Date: Sat, 09 Jan 1993 19:50
55 lines
1961 bytes
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
oddmund@idt.unit.no

******
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) 
                           new-value)
  (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) 
                                   new-value)
  (let ((*test* 24))
    (call-next-method)))

#|
;The following version gets rid of the warning, but is it
;correct (i.e. would it be correct if my declaration were
;trusted):
(defmethod set-first-slot :around ((obj test-class-sub) 
                                   new-value)
  (declare (ignore new-value))
  (let ((*test* 24))
    (call-next-method)))
|#
Technical Details
Message-ID: <199301091950.AA03118@sigyn.idt.unit.no>
Path: arc1-ca.pugleaf.net!sparky!uunet!olivea!apple!goofy!cambridge.apple.com!oddmund@idt.unit.no

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!olivea!apple!goofy!cambridge.apple.com!oddmund@idt.unit.no
From: oddmund@idt.unit.no
Newsgroups: comp.lang.lisp.mcl
Subject: Correct to  ignore params to :around methods?
Message-ID: <199301091950.AA03118@sigyn.idt.unit.no>
Date: 9 Jan 93 19:50:55 GMT
Sender: info-mcl-request@cambridge.apple.com
Lines: 55
Approved: comp.lang.lisp.mcl@Cambridge.Apple.C0M