>
> (PROG1 (SYSTEM:%DEFGENERIC 'DMC-TEST-ARGS-WITH-OPTIONAL.4A
> :LAMBDA-LIST
> '(X &OPTIONAL B)
> :METHOD-COMBINATION
> '(DMC-TEST-ARGS-WITH-OPTIONAL.4))
> (PUSH (DEFMETHOD DMC-TEST-ARGS-WITH-OPTIONAL.4A
> (X &OPTIONAL B)
> (PROGN X B))
> (SYSTEM:GENERIC-FUNCTION-INITIAL-METHODS (FDEFINITION 'DMC-TEST-ARGS-WITH-OPTIONAL.4A))))
>
> Because the macro expander continues to expand the forms before compiling them, it'll expand the DEFMETHOD above. When the DEFMETHOD gets expanded however, it's expansion is dependent on the existence of the generic function. However, since the form as a whole hasn't been interpreted yet, there *is* no generic function: after all, that's being created in the first form of the PROG1.
>
> Something similar probably happens during compilation.
>
>
> I'm now wondering what the next step should be to resolve this situation...
>
>
> Ah. Going back 10 months and looking at the DEFMETHOD macro there, I see now what the difference is between then and now: back then we didn't depend on the GF existing during the macro expansion. Now we do. Can we generate a different macroexpansion which defers the GF-being-defined requirement to evaluation time?
Cute. I think we can beef up %defgeneric to accept a list of method descriptions and the macro environment (for make-method-lambda) and call ensure-method inside %defgeneric, after creating the generic function. I can have a look at that.