From: Robert STRANDH
Subject: how does one use change-class?
Date: 
Message-ID: <6w3djduxzf.fsf@serveur3-1.labri.u-bordeaux.fr>
I have trouble figuring out how to use change-class.  I read the
HyperSpec which lead me to believe I should be able to do something
like this (I am using CMUCL with PCL):

* (defclass c1 ()
    ())

#<STANDARD-CLASS C1 {4802588D}>
* (defclass c2 (c1) 
    ((x :initarg :x)))

#<STANDARD-CLASS C2 {480306AD}>
* (defvar *c* (make-instance 'c1))

*C*
* (change-class *c* 'c2 :x 23)

Invalid number of arguments: 4

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

Debug  (type H for help)

("PRECOMPILE-RANDOM-CODE-SEGMENTS PCL" 4 #<C1 {48036C35}>
C2)[:EXTERNAL]
0] 

doing (describe #'change-class) gives a long list of methods with
exacly two arguments.  However, the HyperSpec says:

change-class instance new-class &key &allow-other-keys => instance

Method Signatures:

change-class (instance standard-object) (new-class standard-class)
&rest initargs

change-class (instance t) (new-class symbol) &rest initargs

I must be missing something, right?
-- 
Robert Strandh

---------------------------------------------------------------------
Greenspun's Tenth Rule of Programming: any sufficiently complicated C
or Fortran program contains an ad hoc informally-specified bug-ridden
slow implementation of half of Common Lisp.
---------------------------------------------------------------------

From: Barry Margolin
Subject: Re: how does one use change-class?
Date: 
Message-ID: <Z2yt5.78$_41.2802@burlma1-snr2>
In article <··············@serveur3-1.labri.u-bordeaux.fr>,
Robert STRANDH  <·······@labri.u-bordeaux.fr> wrote:
>
>I have trouble figuring out how to use change-class.  I read the
>HyperSpec which lead me to believe I should be able to do something
>like this (I am using CMUCL with PCL):
...
>doing (describe #'change-class) gives a long list of methods with
>exacly two arguments.  However, the HyperSpec says:
>
>change-class instance new-class &key &allow-other-keys => instance
>
>Method Signatures:
>
>change-class (instance standard-object) (new-class standard-class)
>&rest initargs
>
>change-class (instance t) (new-class symbol) &rest initargs
>
>I must be missing something, right?

If you look at CLTL2, you'll see that it was originally specified to just
take two arguments.  The initargs was a late addition to the CLOS spec (if
you look at the bottom of the HyperSpec description of CHANGE-CLASS, you'll
see a link to the CHANGE-CLASS-INITARGS cleanup issue).  It sounds like PCL
was never updated to reflect that change, so you have to do it the old way,
as described in the cleanup: call CHANGE-CLASS, then call
REINITIALIZE-INSTANCE.

-- 
Barry Margolin, ······@genuity.net
Genuity, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.
From: Tim Bradshaw
Subject: Re: how does one use change-class?
Date: 
Message-ID: <ey34s3txo8j.fsf@cley.com>
* Robert STRANDH wrote:

> I must be missing something, right?

I think the fact that PCL doesn't implement change-class according to
the spec, which I suppose is one step up from CLISP which doesn't
implement it at all.

(ACL implements it according to the spec, Genera has the same
limitations as CMUCL/PCL.)

--tim