|
Re: Re: defmethod vs &aux?: msg#00044lisp.corman
At 12:42 PM 3/11/03 +0100, Frode Vatvedt Fjeld wrote: Kenny Tilton <ktilton@xxxxxxxxxx> writes: Yeah, that's almost certainly the problem. ;;; N.B. The function kludge-arglist is used to pave over the differences ;;; between argument keyword compatibility for regular functions versus ;;; generic functions. (defun kludge-arglist (lambda-list) (if (and (member '&key lambda-list) (not (member '&allow-other-keys lambda-list))) (append lambda-list '(&allow-other-keys)) (if (and (not (member '&rest lambda-list)) (not (member '&key lambda-list))) (append lambda-list '(&key &allow-other-keys)) lambda-list))) the Hyperspec for DEFMETHOD says " The lambda list of the generic function is congruent with the lambda list of the method being defined; if the defmethod form mentions keyword arguments, the lambda list of the generic function will mention ..... key (but no keyword arguments). If function-name names an ordinary function, a macro, or a special operator, an error is signaled." (I didn't put ..... in there; that's what's there. Presumably its a typo and is supposed to read '&key &allow-other-keys'. So the first clause of KLUDGE-ARGLIST makes sense. But I can't find justification for the 2nd IF clause. Section 7.6.4 doesn't seem to justify it. I guess it's just a simplification: Always allow any sort of keywords to appear in any call to a generic function, and not worry about exactly when they are allowed and when they are not. I leave as an exercise for some user of &AUX variables in DEFMETHODS to rewrite KLUDGE-ARGLIST to do the obvious fix. Note that the last sentence of my quote from the HS is violated in Corman Lisp: no error is signalled when a regular function is defined, and then a method by that name is defined. (I'm not sure why the HS insists on an error being signalled; a warning would seem more appropriate.) To unsubscribe from this group, send an email to: cormanlisp-unsubscribe@xxxxxxxxxxxxxxx Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Screamer ported to Corman Lisp.: 00044, Chris Double |
|---|---|
| Next by Date: | Add dll reference to C# project: 00044, Jim Kelley |
| Previous by Thread: | Re: defmethod vs &aux?i: 00044, Frode Vatvedt Fjeld |
| Next by Thread: | Re: return-from in (defun (setf xxx)...)?: 00044, JP Massar |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |