From: Jim Newton
Subject: how does change-class handle init args?
Date: 
Message-ID: <2m088iFhai9kU1@uni-berlin.de>
Is there a way to use the :initarg specifiers when calling change-class?
 
 
 
 
 


(defclass row-col nil
   (( rows
      :initarg :rows
      :accessor rows)
    ( cols
      :initarg :cols
      :accessor cols)))

(defclass row-col-dx-dy ( row-col)
   (( dx :initarg :dx)
    ( dy :initarg :dy)))

(defclass mosaic ( row-col-dx-dy )
   (( x0 :initarg :x)
    ( y0 :initarg :y)))


(setf best (make-instance 'row-col-dx-dy :dx 0 :dy 0))

(change-class best 'mosaic :x 1 :y 2)   ;; <<<------



Invalid number of arguments: 6

Restarts:
   0: [ABORT] Return to Top-Level.

Debug  (type H for help)

("PRECOMPILE-RANDOM-CODE-SEGMENTS PCL" 6 #<ROW-COL-DX-DY {48061B3D}> 
MOSAIC)[:EXTERNAL]
0]



I get an error when i try it.  is this just a limitation of CMUCL?
The Art of the Metaobject protocol states that the definition of
change-class is as follows:

(defmethod change-class
           ((instance standard-object) (new-class symbol) &rest initargs)
     (apply #'change-class instance (find-class new-class) initargs))

From: Jim Newton
Subject: Re: how does change-class handle init args?
Date: 
Message-ID: <2m08j3Fh5p2lU1@uni-berlin.de>
oops... i see that this was a bug in 18d and previous cmucl.
it is supposedly fixed in 18e. 
http://www.cons.org/cmucl/news/release-18e.txt

does anyone know how i can find out which version i'm running?

-jim

Jim Newton wrote:
> Is there a way to use the :initarg specifiers when calling change-class?
> 
> 
> 
> 
> 
> 
> 
> (defclass row-col nil
>   (( rows
>      :initarg :rows
>      :accessor rows)
>    ( cols
>      :initarg :cols
>      :accessor cols)))
> 
> (defclass row-col-dx-dy ( row-col)
>   (( dx :initarg :dx)
>    ( dy :initarg :dy)))
> 
> (defclass mosaic ( row-col-dx-dy )
>   (( x0 :initarg :x)
>    ( y0 :initarg :y)))
> 
> 
> (setf best (make-instance 'row-col-dx-dy :dx 0 :dy 0))
> 
> (change-class best 'mosaic :x 1 :y 2)   ;; <<<------
> 
> 
> 
> Invalid number of arguments: 6
> 
> Restarts:
>   0: [ABORT] Return to Top-Level.
> 
> Debug  (type H for help)
> 
> ("PRECOMPILE-RANDOM-CODE-SEGMENTS PCL" 6 #<ROW-COL-DX-DY {48061B3D}> 
> MOSAIC)[:EXTERNAL]
> 0]
> 
> 
> 
> I get an error when i try it.  is this just a limitation of CMUCL?
> The Art of the Metaobject protocol states that the definition of
> change-class is as follows:
> 
> (defmethod change-class
>           ((instance standard-object) (new-class symbol) &rest initargs)
>     (apply #'change-class instance (find-class new-class) initargs))
> 
From: JP Massar
Subject: Re: how does change-class handle init args?
Date: 
Message-ID: <iislf05a2eo6a8rs321c0iht102gqrteng@4ax.com>
On Sun, 18 Jul 2004 22:35:51 +0200, Jim Newton <·····@rdrop.com>
wrote:

>oops... i see that this was a bug in 18d and previous cmucl.
>it is supposedly fixed in 18e. 
>http://www.cons.org/cmucl/news/release-18e.txt
>
>does anyone know how i can find out which version i'm running?
>
 
Look up

 LISP-IMPLEMENTATION-VERSION
SOFTWARE-VERSION

and look at the value of the variable

*FEATURES* 

along with its documentation.