[rucksack-devel] Persistent identity

Nikodemus Siivola nikodemus at random-state.net
Thu May 18 14:34:57 UTC 2006


Here's a small identity example / test-case:

   (defclass p-test ()
      ((slot :persistence t :initarg :slot :accessor slot-of))
      (:metaclass persistent-class))

    (let (result)
      (with-rucksack (r "/tmp/test-rucksack/" :if-exists :supersede)
          (let (a)
            (with-transaction ()
              (add-rucksack-root (setf a (make-instance 'p-test :slot 0))
                                 r))
            (with-transaction ()
              (incf (slot-of a)))
            (with-transaction ()
              (incf (slot-of (car (rucksack-roots r)))))
            (with-transaction ()
              (setf result (slot-of a)))))
      result)

I believe RESULT should be 2 in the end. Is that right? (Right
now this breaks at the first INCF. If you comment that one out
the second one works, but the result is 0.)

If so, then I believe (SETF SLOT-VALUE-USING-CLASS) will need to set
up proxies, and not just deserialization.

(Of course, this violates the constraint of holding a reference to an
object outside transaction. If that is accepted as a strict limit,
then the case is meaningless. I'm working on the assumption that
holding on to a root object is legal.)

Cheers,

  -- Nikodemus              Schemer: "Buddha is small, clean, and serious."
                   Lispnik: "Buddha is big, has hairy armpits, and laughs."



More information about the rucksack-devel mailing list