On 06 Mar 2005 23:05:47 +0100, "Tim Daly Jr." <tim@...> wrote:
> There's something I don't quite understand going on here. When I
> delete a package and re-create it, generic functions seem to get
> screwed up.
I'm mostly clueless about the area you've hit, but I daresay someone
will jump on in if I get it /too/ wrong.
> Now we load it, run the test, delete the package :foockage, load it
> again, and the generic function FLOT will signal an error (please
> pardon the verbosity):
But you're /not/ doing this! You're compiling it first:
> * (load (compile-file "/tmp/test.lisp"))
If you /don't/ compile, but just load the file, you'll get the
behaviour you expect.
The compiler is substituting the make-instance call with a direct call
to the constructor, that is, without going through the class symbol
indirection. This means that when the file is loaded the second time,
the constructor call returns an instance of #:FOOASS (i.e. the /first/
FOOASS symbol, now uninterned), /not/ the current FOOASS class. Since
FLOT is defined for the second, but not the former, you get a no
applicable method error.
Declaring make-instance as notinline should get you the semantics you
want wrt delete-package interaction.
Hope this helps,