<div dir="ltr"><div>Hello,</div><div><br></div><div>Here follows Common Lisp code, using a datastore library named bknr.datastore</div><div><br></div><div>    (ql:quickload :bknr.datastore)</div><div><br></div><div>    (defclass userdata (bknr.datastore:store-object)</div><div>      ((email :initarg :email</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">      </span>      :index-type bknr.indices:unique-index</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>      :index-values all-users)</div><div>       (name :initarg :name))</div><div>      (:metaclass bknr.datastore:persistent-class))</div><div><br></div><div>    (let ((object-subsystem (make-instance 'bknr.datastore:store-object-subsystem)))</div><div>      (make-instance 'bknr.datastore:store</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">       </span>    <span class="gmail-Apple-tab-span" style="white-space:pre">        </span> :directory *default-pathname-defaults*</div><div>                     :subsystems (list object-subsystem)))</div><div><br></div><div>    (make-instance 'userdata :email "<a href="mailto:m@b.com">m@b.com</a>" :name "Maria")</div><div>    (make-instance 'userdata :email "<a href="mailto:k@g.com">k@g.com</a>" :name "Katerina")</div><div><br></div><div>    (setf (slot-value (first (all-users)) 'name) "Elena")</div><div>    ; Attempt to modify persistent slot NAME of #<USERDATA ID: 0> outside of a transaction</div><div>    ;   [Condition of type BKNR.DATASTORE::PERSISTENT-SLOT-MODIFIED-OUTSIDE-OF-TRANSACTION]</div><div><br></div><div>    (bknr.datastore:with-transaction ()</div><div>      (setf (slot-value (first (all-users)) 'name) "Elena"))</div><div>    ; runs successfully, the above wrap in with-transaction () is necessary</div><div><br></div><div>I use the Slime inspector to view the datastore, so in the minibuffer after C-c C-I Inspect value (evaluated):</div><div>I input</div><div>    (all-users)</div><div><br></div><div>I can see the data but not edit it in the slime inspector, because the same condition is thrown as above.</div><div><br></div><div>Can the slime inspector be customized in a way that it wraps calls to setf inside transactions?</div><div><br></div><div>PS: if you run the above code, a directory named "current" will be created in your lisp's working directory. It saves the datastore on disk.</div><div><br></div><div>Thank you,</div><div>Christos Gitsis</div></div>