In code quarterly interview with Rich Hickey, Michael Fogus hints that Clojure borrows a lot from Haskell:

Fogus:

As someone who only knows Haskell enough to read the papers, Clojure appears to be influenced by it substantially. From the names and operation of core functions—take, drop, iterate, repeat, etc.—to its protocols facility, there is a lot in Clojure that a Haskell programmer would recognize. Can you elaborate on Haskell’s influences on Clojure both positive and negative?

Hickey:

I think Haskell is a fantastic, awe-inspiring piece of work. I haven’t used it in anger, but it certainly was a positive influence. Haskell obviously goes much further than Clojure in pursuing the ideals of functional programing. In particular they differ in the approach to using types to enforce things.

My question is - Does Clojure borrow concurrency ideas from Haskell? Fogus hints at some syntax, and there is obviously functional laziness. What about the STM and concurrency operators?

Assumptions:

  • I'm asking this question in a positive tone. I think it is great that Rich could see some of the treasures in Haskell and use them.
  • 2
    Really the STM is borrowed from the database people (they were doing it 20 years ago). Haskell doesn't really have the same approach to actors, and atomic variables are pretty universal so... not really. Clojure more borrows Haskell's ideas on purity (pragmatically) – jozefg Dec 15 '13 at 4:58
  • 1
    Looks to me like Clojure's refs are like Haskell's TVars (i.e. STM. dosync is like atomically) Clojure's vars are like Haskell's MVars, but the blocking semantics are different here (can probably be emulated with promises in clojure). So I'd say they are very similar in spirit. – Jon Schoning May 27 '14 at 0:42
  • Care to expand on that? I'm happy to change the accepted question. – hawkeye May 27 '14 at 1:53
up vote 2 down vote accepted

The vibe I'm getting is that the biggest influence on Concurrency in Clojure is Multiversion Concurrency Control - which comes from the database world. We see this with refs, which are part of the MVCC Software Transactional Memory.

What is interesting is the critiques of Clojure's concurrency model by Martin Thompson. His claim is that ultimately the scalability model is limited by Amdahl's law. This is as the refs depend on a Compare and Swap (CAS) operation - which is ultimately sequential, and will eventually become a bottleneck.

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.