> It would be nice to be able to say: > > (defpclass banana () (:index t)) > > (setf banana (make-instance 'banana)) > > ; do stuff with banana, then later optionally: > > (store-indexed-object banana) > > We could then do without proxy objects in Weblocks.
(defun make-deferred-instance (classname &rest initargs) (with-transaction () (let ((obj (apply #'make-instance classname initargs))) (remove-kv (slot-value obj 'elephant::%oid) (find-class-index classname))))) (defun activate-deferred-instance (obj) (let ((oid (slot-value obj 'elephant::%oid)) (idx (find-class-index (class-of obj)))) (if (get-value oid idx) (warn "Attempted to activate Object ~S which is already indexed!" obj) (setf (get-value oid idx) obj)))) This seems to work nicely, even with secondary indices. Haven't tested derived, though. Leslie _______________________________________________ elephant-devel site list elephant-devel@common-lisp.net http://common-lisp.net/mailman/listinfo/elephant-devel