[elephant-devel] Transient slots in non-persistent objects
Peter Bengtson
peter at peterbengtson.com
Fri Oct 22 10:52:37 UTC 2004
The patch should of course look like this, not as previously posted -
the object itself (o) should be passed to #'persistent-slot-p rather
than the class object. However, you might of course decide to implement
this in a different manner. Anyway:
(in-package :elephant)
(defun slots-and-values (o)
(declare (optimize (speed 3) (safety 0)))
(loop for sd in (compute-slots (class-of o))
for slot-name = (slot-definition-name sd)
with ret = ()
do
(when (and (persistent-slot-p o slot-name)
(slot-boundp o slot-name)
(eq :instance (slot-definition-allocation sd)))
(push (slot-value o slot-name) ret)
(push slot-name ret))
finally (return ret)))
(defmethod persistent-slot-p ((class t) (slot-name t))
t)
(export 'persistent-slot-p)
/ Peter
More information about the elephant-devel
mailing list