Opened 11 years ago

Closed 8 years ago

#395 closed enhancement (invalid)

spurious warning in :around method?

Reported by: rme Owned by: gb
Priority: minor Milestone:
Component: Compiler Version: trunk
Keywords: Cc:

Description

I'm not sure it's desirable to warn about JUNK being unused in the :around method below.

(defclass foo ()
  ())

(defmethod do-nothing ((f foo) junk)
  (or junk 42))

(defmethod do-nothing :around ((f foo) junk)
  (format t "~&hi")
  (format t "~&~s" (call-next-method))
  (format t "~&bye"))
;Compiler warnings :
;   In (DO-NOTHING :AROUND (FOO T)) inside an anonymous lambda form: Unused lexical variable JUNK

Change History (1)

comment:1 Changed 8 years ago by rme

  • Resolution set to invalid
  • Status changed from new to closed

From the spec entry for defmethod:

The expansion of the defmethod macro "refers to" each specialized parameter (see the description of ignore within the description of declare). This includes parameters that have an explicit parameter specializer name of t. This means that a compiler warning does not occur if the body of the method does not refer to a specialized parameter, while a warning might occur if the body of the method does not refer to an unspecialized parameter. For this reason, a parameter that specializes on t is not quite synonymous with an unspecialized parameter in this context.

http://lisptips.com/post/15025308254/referring-to-method-parameters

Note: See TracTickets for help on using tickets.