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

changing &key/&rest in generic function lambda lists



re: . . . 
    ;;; Define a method...
    (defgeneric random-function ((foo random1))
      )
    ;;; Do something stupid...
    (defmethod random-function ((foo random1) &key bar)
      t)
    . . . 

The basic problem you have here is that your comments are interchanged.

The "stupid" thing you did was in the DEFGENERIC form, not in the
DEFMETHOD one.  Recall that a DEFGENERIC wants a "lambda list", which
is more like a prototype lambda-list for a (regular) function rather 
than a specialized-lambda-list for a method.  As a result of that gaffe,
PCL puts something totally random in the arglist slot of the the generic
function, which as you might suspect isn't congruent with your method 
lambda-list.  I suspect a CLOS implementation ought to signal an error
for such a morphological error in a DEFGENERIC form.


-- JonL --


P.S.  Above, I say "slot" loosely, as PCL accesses this information 
      with GENERIC-FUNCTION-PRETTY-ARGLIST rather than the more expected
      GENERIC-FUNCTION-LAMBDA-LIST.