From: David Bakhash
Subject: CLOS problems...
Date: 
Message-ID: <wklne9wnl5.fsf@mit.edu>
I tried to load some code from a Lisp file and got this:

Error: Attempt to add the method
       #<STANDARD-METHOD MAKE-LOAD-FORM (FSA) @ #x87ffda> to the generic
       function #<STANDARD-GENERIC-FUNCTION MAKE-LOAD-FORM> but the method has
       fewer optional arguments than the generic function.
  [condition type: PROGRAM-ERROR]

Restart actions (select using :continue):
 0: Add method anyway and modify generic function.
 1: retry the load of /tmp/cadet/Xerox/src/fsa/fsa-basics.lisp
 2: skip loading /tmp/cadet/Xerox/src/fsa/fsa-basics.lisp


I thought, however, that optional args were _not_ part of the
definitions of generic functions.

What I'm wondering why having (&optional arg) in a defgeneric affects
that function for methods which don't use the optional arg.  I always
thought that methods only had to have congruent arglists to be
compatible with one another.  Of course, in this case, the optional arg
is in the defgeneric form, but I'd appreciate a hint of why this is the
case.

dave
From: Kent M Pitman
Subject: Re: CLOS problems...
Date: 
Message-ID: <sfwn1ypz7ub.fsf@world.std.com>
David Bakhash <·····@mit.edu> writes:

> I thought, however, that optional args were _not_ part of the
> definitions of generic functions.

They're not part of the dispatch part.  They are certainly part of the
argument signature.

> What I'm wondering why having (&optional arg) in a defgeneric affects
> that function for methods which don't use the optional arg.  I always
> thought that methods only had to have congruent arglists to be
> compatible with one another.  Of course, in this case, the optional arg
> is in the defgeneric form, but I'd appreciate a hint of why this is the
> case.

There are a number of annoying little cases like this where I'd argue
(and did argue, unsuccessfully) the congruency rules are too
conservative and inhibit some reasonable choices.  I'd have to think
more on it to think whether this was one, but it looks like it might
be.  I think there were some involving substitutability of &rest for
&key that also bugged me.  I don't think anyone did a proper logical
proof that the congruency rules were well-chosen.  I think they are ad hoc.
Dunno if that helps you sleep better ...