On Mar 9, 9:26 am, Nick Wiedenbrueck <nick.wiedenbru...@googlemail.com> wrote: > I'm still getting started with Clojure and I'm wondering about how one > should generally go about concurrency and how transparent concurrency > is in Clojure. So, to me there would be two approaches: > > A) Be aware of the parts of your system that will be concurrent and > only within these parts write concurrent code using reference types > and so on.
Basically, yes. But note that any code that doesn't use atoms, refs and other mutable stuff "is concurrent" by itself. The ref types are the ones that require some thought. As a rough rule of thumb, this means you want to keep the number of reference objects down. > My question here would be, how much a developer has to > scratch his head about concurrency. Agreed, it's much easier than > using locks like in Java, but still I have to think about what should > be a ref, what should be an agent and how to set up transactions. You always have this problem. But really, if you're new to clojure, you don't need refs nearly as much as you probably think right now. > B) Write concurrent code where you can, even the (smallest) parts of > your system which aren't necissarily inherently concurrent. The > question here is, if handling concurrency in Clojure is simple enough > to go about it this way, or if it would be much less effort to write > non-concurrent code. > > So, in general I think the question is, how transparent concurrency is > in Clojure. The ultimate goal would be to just write code, that is > concurrent, but to not have to think to much about it. Again, anything that doesn't use mutable objects is automatically concurrent. But I think you're conflating concurrency and parallelism. Joost. -- 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