Subject: [clisp-list] Clos problems when initialize-instance returning unusual objects

From: Karsten <[email-masked]>
Date: Mon Oct 15 15:16:03 2001

Hello,

I have the following problem in Clisp 2.27 Windows ME, but I assume it 
happens on every platform.

make-instance seem to return whatever initialize-instance returns, even if 
it is totally bogus
The following code illustrates the problem, works fine in ACL and LW but 
warns in CLISP

Un saludo

Karsten

(defclass foo ()
   ()
   )

(defclass bar ()
   ()
   )

(defmethod initialize-instance ((me foo) &rest initargs)
   (declare (ignore initargs))
   (make-instance 'bar))

(defclass foofoo (foo)
   ()
   )

(defmethod initialize-instance ((me foofoo) &rest initargs)
   (declare (ignore initargs))
   nil)

(defun test (class-symbol)
   (let ((object (make-instance class-symbol)))
     (unless (typep object 'foo)
       (warn "Wrong Class ~a should be ~a" (class-of object) (find-class 
class-symbol)))))

(defun test-classes ()
   (test 'foo)
   (test 'foofoo))

---

From: Sam Steingold <[email-masked]>
Date: Thu Oct 18 13:18:14 2001

> * In message <[email-masked]>
> * On the subject of "[clisp-list] Clos problems when initialize-instance returning unusual objects"
> * Sent on Tue, 16 Oct 2001 00:14:44 +0200
> * Honorable Karsten <[email-masked]> writes:
>
> make-instance seem to return whatever initialize-instance returns,
> even if it is totally bogus

indeed, this is a bug, thanks for reporting it.
I just committed a fix to the CVS.

-- 
Sam Steingold (http://www.podval.org/~sds)
Keep Jerusalem united! <http://www.onejerusalem.org/Petition.asp>
Read, think and remember! <http://www.iris.org.il> <http://www.memri.org/>
He who laughs last did not get the joke.