[Openmcl-devel] metaclass problems with Elephant
Alex Mizrahi
alex.mizrahi at gmail.com
Tue Sep 13 07:18:01 PDT 2011
hi
I'm one of developers of Elephant 'persistent object database' library
(which heavily uses CLOS and MOP).
I've recently discovered that Elephant does not work with recent
versions of CCL, particularly, 1.7 and 1.6 IIRC.
(Ian Eslick says that it was working with older versions, so I guess
it is a regression.)
After a long investigation of the problem it turned out that
re-defining metaclass "fries" its classes, e.g. slots disappear,
sometimes superclasses... scary stuff.
Here's how to reproduce it:
1. Load elephant: (asdf:oos 'asdf:load-op :elephant)
2. Check that class slots are present:
CL-USER> (class-slots (find-class 'ele::default-slot-set))
(#<TRANSIENT-EFFECTIVE-SLOT-DEFINITION for instance slot ELEPHANT::OID
#x302000B5AB5D> #<TRANSIENT-EFFECTIVE-SLOT-DEFINITION for instance
slot ELEPHANT::SPEC #x302000B5AABD>
#<PERSISTENT-EFFECTIVE-SLOT-DEFINITION for instance slot
ELEPHANT:BTREE #x302000B5A9AD>)
3. Evaluate (defclass persistent-metaclass ...) in
elephant/src/elephant/metaclasses.lisp
4. Confirm that slots are gone:
CL-USER> (class-slots (find-class 'ele::default-slot-set))
NIL
5. Finalizing class doesn't help it:
CL-USER> (let ((ele::*warn-when-dropping-persistent-slots* nil))
(finalize-inheritance (find-class 'ele::default-slot-set)))
NIL
CL-USER> (class-slots (find-class 'ele::default-slot-set))
NIL
6. But re-defining its super-class does: re-evaluate (defclass
persistent-object ...) in elephant/src/elephant/classes.lisp
Now slots are back:
CL-USER> (class-slots (find-class 'ele::default-slot-set))
(#<TRANSIENT-EFFECTIVE-SLOT-DEFINITION for instance slot ELEPHANT::OID
#x302000DFDFBD> #<TRANSIENT-EFFECTIVE-SLOT-DEFINITION for instance
slot ELEPHANT::SPEC #x302000DFDBED>)
I don't know any way to reproduce it which does not involve loading
elephant (and I'm not even totally sure that this bug is not caused by
some Elephant's mis-use of MOP), but perhaps information above is
enough?
More information about the Openmcl-devel
mailing list