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