[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Changing the :metaclass of a class



  Received: from Semillon.ms by ArpaGateway.ms ; 02 MAY 89 10:15:12 PDT
  Date: Tue, 2 May 89 10:06 PDT
  From: Gregor.pa@xerox.com
  Subject: Re: Changing the :metaclass of a class
  To: Darrell <shane%blackcomb@rand.org>
  Cc: commonloops.pa@xerox.com, Stephanie_Cammarata <steph@rand.org>
  Fcc: BD:>Gregor>mail>outgoing-mail-6.text.newest
  In-Reply-To: <8905011955.AA05406@blackcomb.arpa>
  Message-Id: <19890502170618.0.GREGOR@SPIFF.parc.xerox.com>
  Line-Fold: no
  
      Date: Mon, 01 May 89 12:55:17 PDT
      From: Darrell <shane%blackcomb@rand.org>
  
      ;;; Why is it that when I change the :metaclass of a class, 
      ;;; the class instance is not changed?  For example:
  
  This is because of a structural bug in PCL.  Unfortunately, this won't
  be fixed in this week's release.  It should be fixed this month though.
  
  Note that in almost all cases, you can just use change-class by hand on
  the class object.
  -------

I had a patch for this in the Cute version of PCL, that I forgot to
mention to anyone.  This might work ok until Gregor fixes it.
;;;
;;; Patch std-class.lisp
;;; KRA 89/3/30:  Let class-change happen if the metaclass of a class changes.

;;;
;;; CLASS-FOR-REDEFINITION old-class proto-class name ds-options slotds
;;; protocol: class definition
;;; 
;;; When a class is being defined, and a class with that name already exists
;;; a decision must be made as to what to use for the new class object, and
;;; whether to update the old class object.  For this, class-for-redefinition
;;; is called with the old class object, the prototype of the new class, and
;;; the name ds-options and slotds corresponding to the new definition.
;;; It should return the class object to use as the new definition.  It is
;;; OK for this to be old-class if that is appropriate.
;;; 
(defmethod class-for-redefinition ((old-class standard-class)
				   (proto-class standard-class)
				   name
				   local-supers
				   local-slot-slotds
				   extra)
  (declare (ignore name local-supers local-slot-slotds extra))
  (UNLESS (EQ (CLASS-OF OLD-CLASS) (CLASS-OF PROTO-CLASS))
      (CHANGE-CLASS OLD-CLASS (CLASS-OF PROTO-CLASS)))
  old-class)