On Fri, Jun 11, 2010 at 8:45 AM, Steve Molitor <stevemoli...@gmail.com> wrote:
> I'm a clojure newbie trying to understand when to use atoms versus refs.
> In clojure-http.resourcefully, if you use the with-cookies macro stores the
> cookies in a thread local ref.  Why a ref and not an atom?  My impression is
> that refs are for when you need to coordinate changes to more than one
> variable, or maybe if you need triggered validations.

Actually you're correct; an atom would be better here. I wrote that
code a long time ago and haven't used or looked at it since, but
there's absolutely no reason to pull in the STM for state changes like
that.

-Phil

-- 
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

Reply via email to