if you do it as a lock, then readers must block writers (think it
through). Clojure's reference types + immutable datastructures and the
views on perception that underlay them are strongly opposed to readers
interfering with writers.

http://www.infoq.com/presentations/Are-We-There-Yet-Rich-Hickey around
27:48 Rich discusses perception

On Tue, Jul 17, 2012 at 3:57 PM, Warren Lynn <wrn.l...@gmail.com> wrote:
> I have a hard time understanding why there is a need to retry when doing
> "swap!" on an atom. Why does not Clojure just lock the atom up-front and do
> the update? I have this question because I don't see any benefit of the
> current "just try and then re-try if needed" (STM?) approach for atom (maybe
> OK for refs because you cannot attach a lock to unknown ref combinations in
> a "dosync" clause). Right now I have an atom in my program and there are two
> "swap!" functions on it. One may take a (relatively) long time, and the
> other is short. I don't want the long "swap!" function to retry just because
> in the last minute the short one sneaked in and changed the atom value. I
> can do the up-front lock myself, but I wonder why this is not already so in
> the language. Thank you for any enlightenment.
>
> --
> 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



-- 
And what is good, Phaedrus,
And what is not good—
Need we ask anyone to tell us these things?

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