[armedbear-devel] CLOS / D-M-C tests failure DMC-TEST-MC.1 help requested

Erik Huelsmann ehuels at gmail.com
Tue Aug 7 19:09:01 UTC 2012


> What happens is that the second form expands into:

> >
> > (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.
>

I can see how doing that would work at run-time, ie where %defgeneric would
be called without the image having been exited (simply grab the environment
and tuck it in a closure, or even simply stick it in the expansion).
However, how do you expect to do the same at file-compilation time where
the %defgeneric gets called after the image (possibly) has been closed and
cleanly started up?


Bye,


Erik.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/armedbear-devel/attachments/20120807/b5b26311/attachment.html>


More information about the armedbear-devel mailing list