[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
changing &key/&rest in generic function lambda lists
- To: cmaeda@CS.CMU.EDU
- Subject: changing &key/&rest in generic function lambda lists
- From: Jon L White <email@example.com>
- Date: Mon, 28 May 90 09:33:50 PDT
- Cc: CommonLoops.pa@Xerox.COM
- In-reply-to: "Christopher M. Maeda"'s message of Fri, 25 May 90 16:02 EDT <19900525200225.2.MAEDA@SKUNK.CS.CMU.EDU.CMU.EDU>
- Redistributed: CommonLoops.pa
re: . . .
;;; Define a method...
(defgeneric random-function ((foo random1))
;;; Do something stupid...
(defmethod random-function ((foo random1) &key bar)
. . .
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