halgari/clojure-py — pull request #141 by lfranchi (2012-10-30 23:14:27+00:00)
Title: Implement refs/STM support in clojure-py

This adds support for the STM and refs subsystem in clojure-py. See my email to the clojure-py mailing list for some more details, but particular things that might be of concern:

* I imported shared_lock and exc_string from http://www.targeted.org/python/recipes/shared_lock.py since I need a reentrant read-write lock, and python's stdlib doesn't provide one. MIT license.
* At the moment this is a pretty direct port of the Java LockingTransaction/Ref classes. I want to step back a bit and see how to refactor it to be a bit more "idiomatic" if/where possible, but I wanted to get a working port first
* Most of the thorough tests are in python, not in clojure code. That's partially because a proper clojure test would exercise the transactions with agents, but there is no agent support yet :)
* Not 100% of ref is supported: max/min history is not configurable from clojure, watchers/notifiers *should* work but I don't think there's a way to add them from the clojure side either.

I know this is a big ol' chunk of code and python is not my first language, so have away with comments/critiques and I'm happy to work through and improve the patch :)

cheers,
leo