Jim, The value for all refs whose value you don't actually modify inside a transaction should be obtained through ensure<http://clojuredocs.org/clojure_core/clojure.core/ensure> if you want to make sure :P their value won't be changed by a different transaction, that way you get a consistent value when the current transaction is finally committed.
In the example you show, this is not a problem since all transactions change the value of all the refs they read, but it's something to take into account if you have a bunch of transactions doing different things and only reading from some of the refs. J On Wednesday, November 20, 2013 5:17:38 AM UTC-10, Stefan Kamphausen wrote: > > Hi, > > you would only want to use Refs when you need to update at least two of > them with transaction semantics. > > When you need to read only one of them, you can just deref them any time > you want, if you need a consistent snapshot of two refs, you need to read > them inside a transaction, i.e. inside dosync. > > For an example of the difference search for ";; replace with do for > errors" on > http://skamphausen.de/clojure-workshop-sourcetalk2012/prj/workshop.trade/src/workshop/trade/core.clj(if > I may be so bold to link to my own humble experiments with the STM). > > Best, > stefan > -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.