Hello everyone, to clarify one of the points that are important to me, I have prepared this working sketch:
(defmethod slot-value-using-class ((class persistent-metaclass) (instance persistent-object) (slot-def persistent-slot-definition)) "Get the slot value from the database." (let* ((name (slot-definition-name slot-def)) (value (persistent-slot-reader (get-con instance) instance name)) (data-type (type-of value)) ; type of data in store (slot-type (sb-mop::slot-definition-type slot-def))) ; type declared in defclass (format t "slot-value-using-class for slot ~A (declared type '~A'); value '~A', type '~A'~%" name slot-type value data-type) (if (typep data-type slot-type) value #| here we would call the user-provided change-class for the old and new types |# ))) Notes: * it's obviously implementation dependent as of yet, but this is trivial. * we should provide a way for the user to specify that this type checking shouldn't take place, for performance reasons. This is simple, too. * as you can see, I don't care much about evolution at the class level (class renamed, substituted, ...) right now, but at the slot level. * I don't see any other way than slot-value-using-class to catch type changes. They can occur at every place in time between slot reads. * the replacement of slots (one slot discarded, new slot added -- how do we connect this?) could be done by a ":replaces" slot initarg. But this collides with multiple subsequent replacements, so I think the most sensible way would be a new class option named "version" of type integer. This would facilitate a user-level schema evolution protocol as outlined in the recent discussion: (defmethod elephant:class-evolve ((class myclass) (version (eql 1)) (version (eql 2))) [obviously would implement transition 1->2 for class "foo"] And Ian, thanks for your concise, patient and quick answers. I thought one could never get *all* three of those :) Leslie -- My personal blog: http://blog.viridian-project.de/ _______________________________________________ elephant-devel site list elephant-devel@common-lisp.net http://common-lisp.net/mailman/listinfo/elephant-devel