I am fairly familiar with basic functional programming. I've studied a bit of scheme and Haskell. I don't quite understand Vars, Refs, Agents and Atoms. I am a Java developer and have worked with concurrency constructs: locks, synchronized, Executor framework, etc.
I've read a couple of chapters of the upcoming Clojure book and the tutorial at http://en.wikibooks.org/wiki/Learning_Clojure. Vars seem to be basic mutable variables. What is root binding and thread local binding? I am _very_ interested in 'monkey patching' running systems, which apparently involve vars, but root binding and thread local bindings are a bit confusing. Refs can apparently only be changed in transactions (presumably similar to database transactions or Haskell's transactions). I understand that, but why are vars and refs different? Agents can only be changed through a queue. I assume this is so the process of changing an agent is asynchronous and changes are applied in order. Are agents basically just actors (similar to Erlang)? Atoms ensure atomic changes to a mutable variable...so we have the option of mutating a variable in an atomic manner (single command) or doing so in a transaction (perhaps involving several operations)? There are several descriptions of each of these constructs, but I'm not quite sure which is most appropriate for what. I recall from discussion on reactive programming/CELLS that more experienced folks weren't sure which of these should be used as the base for CELLs implementation. Could this be an example of over-engineering? Is it better to have these four constructs or is it better to combine them and alter their behavior by using different higher order functions? eh...the last sentence probably doesn't mean anything....I'm just trying to get an intuitive feel for them. Thanks --~--~---------~--~----~------------~-------~--~----~ 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 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 -~----------~----~----~----~------~----~------~--~---