[Openmcl-devel] Redefining subclasses of Objective-C classes
Willem Rein Oudshoorn
woudshoo at xs4all.nl
Sun Sep 19 07:54:57 PDT 2010
Just quick question, it seems to me that
redefining lisp subclasses of ns:ns-object do not work.
Initially it seems to work, but it seems that existing
instances are not updated correctly.
See the following transcript:
;;; First create a class
CL-USER> (defclass test-class (ns:ns-object) ((a :accessor a :initform 'a)) (:metaclass ns:+ns-object))
#<OBJC:OBJC-CLASS TEST-CLASS (#xD04E040)>
;;; Make an instance
CL-USER> (setf *a* (make-instance 'test-class))
#<TEST-CLASS <TestClass: 0xd0770e0> (#xD0770E0)>
;; Accessing slot a works:
CL-USER> (a *a*)
A
;; Redefining the class, notice that slot b is inserted
;; before slot a
CL-USER> (defclass test-class (ns:ns-object) ((b :accessor b :initform 'b) (a :accessor a :initform 'a)) (:metaclass ns:+ns-object))
#<OBJC:OBJC-CLASS TEST-CLASS (#xD04E040)>
;; Testing slot a on the existing instance
CL-USER> (a *a*)
This generates an error:
Array index 2 out of bounds for #<SLOT-VECTOR #x3020012A8B3D> .
[Condition of type SIMPLE-ERROR]
Is this a bug? Or is this something like, don't do that.
Kind regards,
Wim Oudshoorn.
More information about the Openmcl-devel
mailing list