(sorry for all the quoted text!)
William Harold Newman wrote:
> On Wed, May 30, 2001 at 10:38:06AM +0200, Martin Atzmueller wrote:
> > Attached is a patch for pcl that fixes two bugs reported on cmucl-imp
> > (based on work by pierre mai), and removes some dead code from pcl.
> > Also, I wanted to get rid of some bogus "redefinition warnings" when
> > defining a class, and so I reviewed the "inform the type system" stuff,
> > and deleted, what was unnecessary.
> > - commented out code to inform the type system about a class, such
> > that a CONSTANTLY-NIL returning type-predicate was created.
> > This caused a redefinition warning when defining classes at the
> @@ -125,10 +121,14 @@
> `(progn ; ..the defstruct can be compiled.
> ,(class-defstruct-form (find-class name))
> - (progn
> - (when (eq *boot-state* 'complete)
> - (inform-type-system-about-std-class name))
> - defclass-form)))))))
> + #| MNA: REMOVEME??
> + is it really necessary to put class-predicates to always
> + return CONSTANTLY-NIL in the compile-time environment?
> + (progn
> + (when (eq *boot-state* 'complete)
> + (inform-type-system-about-std-class name))
> + |#
> + defclass-form))))))
> I don't completely understand what's going on here, but it looks to
> me, just based on local inspection of the code (sometimes dangerous
> with PCL, but worth a try..) that just doing nothing here (i.e.
> commenting out the PROGN and not replacing it with anything) isn't
> right. As I understand it, the commented-out code tries to notify the
> type system when a class other than a DEFSTRUCT has been defined. That
> seems like an appropriate thing to do, since otherwise I'd expect code
> like this
> (DEFCLASS FOO ..)
> (DEFUN BARF (X)
> (TYPECASE X
> (FOO ..)
> (LIST ..)
> to generate bogus "undefined type FOO" warnings when it's compiled.
Actually, while working on the tests for the "inline-type-test" patch,
I found that code like that already causes warnings like that
(in SBCL-0.6.12.27 as well as in SBCL-0.6.12).
(TYPEP (make-instance 'foo) 'foo)
added to the code above will cause an "undefined type FOO" warning.
> So, I'd guess that the proper fix would be not to comment out the call
> to INFORM-TYPE-SYSTEM-ABOUT-STD-CLASS, but instead to make
> INFORM-TYPE-SYSTEM-ABOUT-STD-CLASS do the right thing.
> On the strength of this guess, I undid this part of your patch (and
My guess right now is, that it won't harm to remove the code I commented
out, because the right type-declaration is established, when the class
is loaded. If the warning appears even in the _unpatched_ SBCL version,
this may be valid.
So, further investigation is needed.
As I wrote before, I'll look into this again. And I hope it will not
turn out to be such a great problem, but
a) it's PCL, which is slightly complicated, sometimes, and
b) small looking problems are enormous problems, sometimes.
Martin Atzmueller <martin@...>