Thanks all.
How would I do this protocol extension thing? My guess is that I need
to define the IAtom protocol myself, and then do something like this?
(defprotocol IAtom
(compare-and-set! [])
...)
(extend-type clojure.lang.Atom
IAtom
(compare-and-set! [])
...
IDeref
(deref []))
B
+1
There is no STM integration with atoms. That's not a concern.
Just write your own Clojure core with your change. I did for durable
identities. git://github.com/kwanalyssa/clojure.git
Seriously though, just use protocols.
Thanks,
Alyssa
On Dec 6, 5:24 am, Benjamin Teuber wrote:
> I guess
On Dec 6, 11:52 am, "pepijn (aka fliebel)"
wrote:
> You can not extend them, as they are marked final.
You can extend Clojure protocols to final classes.
> Another point to consider is clojure-in-clojure. If that is ever going
> to happen, one needs to be able to implement Atom as well.
clojure
You can not extend them, as they are marked final.
Another point to consider is clojure-in-clojure. If that is ever going
to happen, one needs to be able to implement Atom as well. It is also
generally better to code to an interface rather than to an
implementation.
Alter and send also work diffe
I guess it was Rich's intention to have swap! be used for real atoms
only so your code remains understandable - that's why it's called
swap! for atoms, alter for refs and alter-var-root for vars.
So why not define your own protocol for updating documents? If you
really want (usually bad idea, I gu
tl;dr: Please add an interface to clojure.lang.Atom. kthxbye
I had the brilliant idea of using CouchDB for something equally brilliant, and
if possible implement a Clojure view server. Turns out Clutch fits the bill
perfectly, except that I would like to use Aleph, and Couch is using something