Ah! Thank you very much for this explanation!! Sent from my iPhone
> On Jun 22, 2015, at 4:40 PM, Francis Avila <[email protected]> wrote: > >> On Monday, June 22, 2015 at 5:09:49 PM UTC-5, marc fawzi wrote: >> It's what I had imagined. So is it fair to say that what is idomatic in >> Clojure may not be idiomatic in ClojureScript? > > ClojureScript itself uses volatile! in all its stateful transducer > implementations (just like Clojure), which is a pretty strong argument that > it is idiomatic cljs. > >> The negligible advantage it offers in ClojureScript does not justify losing >> the functionality of the atom IMO but I may be wrong > > > Volatile is used in precisely those circumstances where the additional > features of atom should *not* be used. Not merely aren't needed, but should > be prohibited from use because the state it holds is not meant to be shared. > Validation and notification are features to facilitate sharing state. > > This is to me the advantage it has over an atom in cljs: it makes clear that > this is a mutable local that is not meant to escape to the caller or provide > access to shared state. Volatile says "mutation for speed, not for shared > access." Atoms do not signal that by themselves because they are meant for > shared access. > > -- > Note that posts from new members are moderated - please be patient with your > first post. > --- > You received this message because you are subscribed to the Google Groups > "ClojureScript" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/clojurescript. -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups "ClojureScript" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/clojurescript.
