
On 26 Aug 2012, at 21:26, Rudolf Schlatte <rudi@constantly.at> wrote:
On Aug 26, 2012, at 19:17, Pascal Costanza <pc@p-cos.net> wrote:
OK, class redefinition doesn't trigger the obsolete instance structure protocol correctly, it seems. Here is a transcript:
CL-USER(1): (defclass person () (name)) #<STANDARD-CLASS PERSON {1E631646}> CL-USER(2): (defparameter *p* (make-instance 'person)) *P* CL-USER(3): (setf (slot-value *p* 'name) "name") "name" CL-USER(4): (defclass person () (name address)) #<STANDARD-CLASS PERSON {1E631646}> CL-USER(5): (use-package :mop) T CL-USER(6): (class-slots (find-class 'person)) (#<SYSTEM:SLOT-DEFINITION NAME {1A60232C}> #<SYSTEM:SLOT-DEFINITION ADDRESS {37A0B39B}>) CL-USER(7): (setf (slot-value-using-class (find-class 'person) *p* (second *)) "address") #<THREAD "interpreter" {43F31EDC}>: Debugger invoked on condition of type TYPE-ERROR The value 1 is not of type (INTEGER 0 1). Restarts: 0: TOP-LEVEL Return to top level.
The problematic part seems to be the use of slot-value-using-class here. With just slot-value, this works fine...
(set-)standard-instance-access didn't check for invalid object layout, fixed in r14137. Pure slot-value goes through a different code path for classes with metaclass standard-class, which did the check and update already.
Perfect, these bug fixes come in very fast… :) OK, on to the next bug: It seems that anonymous classes are always considered subtypes of other classes. This is not correct. Here is transcript: CL-USER(1): (defparameter *c1* (make-instance 'standard-class)) *C1* CL-USER(2): (defparameter *c2* (make-instance 'standard-class)) *C2* CL-USER(3): (subtypep *c1* *c2*) T T CL-USER(4): (defclass c1 () ()) #<STANDARD-CLASS C1 {4ABAD094}> CL-USER(5): (defclass c2 () ()) #<STANDARD-CLASS C2 {2EC195E3}> CL-USER(6): (subtypep 'c1 'c2) NIL T CL-USER(7): (subtypep (find-class 'c1) (find-class 'c2)) NIL T CL-USER(8): (subtypep *c1* 'c1) T T CL-USER(9): (subtypep 'c1 *c1*) NIL T (The integration of types and classes is a bit complex. See 4.3.1 in the HyperSpec, especially the notion of "proper name", and 4.3.7.) Pascal -- Pascal Costanza The views expressed in this email are my own, and not those of my employer.