Hi, On Fri, May 14, 2010 at 01:47:00PM -0700, ka wrote:
> Isn't ensure necessary? Because http://clojure.org/refs says that - > "No changes will have been made by any other transactions to any Refs > that have been ref-set/altered/ensured by this transaction." It > doesn't guarantee that a ref 'r' will not change if we have (dosync > (..bunch of stuff not involving r..) @r (..bunch of stuff not > involving r..)). > > So shouldn't we have to do - > > (defn report-status > [] > (apply println (dosync [(ensure my-hash) (ensure new-keys)]))) I don't think so. We just want a consistent snapshot of my-hash and new-keys. This is done via dosync. Whether the specific value of the refs changed already, when the transaction "commits", is not interesting to us. Ensure is required if you need the ref to have a certain value at commit time. We don't care for the exact value, just for consistency. Sincerely Meikel -- 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