Referring to method parameters

In defmethod lambda lists, required parameters that aren’t explicitly specialized default to specializing on the system class t. But there’s a difference between an implicit and explicit specialization on t. The hyperspec explains:

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.

This makes a difference in Clozure CL; here’s what you get if you don’t use an implicitly specialized required parameter:

? (defmethod foo (bar) 42)
;Compiler warnings :
;   In (FOO (T)) inside an anonymous lambda form: Unused lexical variable BAR

There is no warning with an explicit specialization:

? (defmethod bar ((baz t)) 42)

(Thanks to Hans Hübner.)