Could we please curb the pedantry? On Sat, Jun 29, 2013 at 9:21 PM, Ben Wolfson <wolf...@gmail.com> wrote:
> On Sat, Jun 29, 2013 at 6:06 PM, Cedric Greevey <cgree...@gmail.com>wrote: > >> Who said swap *was* CAS, rather than was implemented *in terms of* CAS? >> In any event, your claim that "no comparison is done unless it's done in >> the supplied function" is just plain wrong. Comparison *is* done, outside >> that function, to make sure the atom wasn't changed by another thread while >> the function was executing. >> > > "swap! is for "CAS"" > > The claim here is clearly not that swap! is implemented in terms of CAS > (which would be very unenlightening, since the question was about the > distinction between swap! and reset!, which can *also* be implemented in > terms of CAS). I admit it would have been more careful of me to say that > the semantics of swap! are such that whether or not any comparison is done > is an implementation detail; those semantics (which are that swap! > "[a]tomically swaps the value of atom to be: (apply f current-value-of-atom > args)" don't specify a comparison, which is not the case with CAS. (reset! > *isn't* implemented in terms of swap! or CAS, but it *could* be, as far as > the semantics are concerned; if it were, I think it would still be right to > say that reset! conceptually doesn't do a comparison against anything, even > though, again, as an implementation detail, it could.) > > Or just look at the source for clojure.lang.Atom.swap(): >> > > IOW, "the first 100 lines of Atom.java contain all the answers"? > > > > -- > Ben Wolfson > "Human kind has used its intelligence to vary the flavour of drinks, which > may be sweet, aromatic, fermented or spirit-based. ... Family and social > life also offer numerous other occasions to consume drinks for pleasure." > [Larousse, "Drink" entry] > > -- > -- > 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 a topic in the > Google Groups "Clojure" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/clojure/PBiSzidSIVM/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > clojure+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- -- 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.