Welcome! Please see the About page for a little more info on how this works.

0 votes
in Clojure by

(ticket requested here http://groups.google.com/group/clojure/browse_thread/thread/119311e89fa46806/4903ce25ff6deaa6#4903ce25ff6deaa6)

The general idea is to declare invariants inside a transaction and, when at commit time an invariant doesn't hold anymore, the transaction retries.
So it can both act as a kind of soft ensure or to specify actions that "partially commute".
Thus it would enable coarser refs.

See the attached file for quick prototype.

User code would looks like:

`(invariant (@world :key))
(commute world update-in [:key] val-transform-fn)`

This means the commute will occur only if (@world :key) returns the same value in-transaction and at commit point.

2 Answers

0 votes
by
0 votes
by
Reference: https://clojure.atlassian.net/browse/CLJ-213 (reported by alex+import)
...