From: Rich Hickey <richhic...@gmail.com>
Date: Fri, 23 Nov 2007 09:00:42 -0800 (PST)
Local: Fri, Nov 23 2007 12:00 pm
Subject: Re: Erlang vs Clojure
On Nov 22, 4:57 pm, Robin <robi...@gmail.com> wrote:
> Erlang: The Movie <=> Clojure: The Podcast
It's a fun comparison, but one I'd like to be careful about. Clojure
> Single Assignment <=> Immutable Data Structures > Mnesia <=> STM > ErlangVM <=> JVM > Hipe <=> JIT > Pattern Matching <=> Multimethods > Erlang Shell <=> REPL > Hot Code Reload <=> Dynamic Compilation > Behaviours <=> Extensible Abstractions > Tail Recursion <=> recur > fun <=> fn > syntax from 1987 <=> syntax from 1958 > EMP2 <=> CL style macros > Fiber/Actor <=> Termite? has a different philosophy about concurrency than does Erlang, neither being right or wrong, but yielding somewhat different results as you encounter each decision point in the design. The difference is, I think, (and I'm hesitant to speak for Erlang, which I quite respect and am no expert on): In Erlang the concurrency model is (always) a distributed one and in
I have some reservations about unifying the distributed and non-
> The burning question:
Clojure has a synchronous reference mutation model in its STM and I am
> Can Termite be ported to Clojure?
wrapping up an asynchronous reference (actor) model for Clojure. The basic idea is that actors are mutable references to immutable values. An actor reference can be made to refer to a new immutable value (only) by sending it a message. Messages are functions (and, optionally, additional arguments) that are applied to an actor's value and whose return value becomes the actor's new value. Message sends return immediately and the actual work happens asynchronously in a thread pool. Because messages are functions they can also be multimethods and therefore messages are potentially polymorphic. Also, because the set of functions is open, the set of messages supported by an actor is also open, a sharp contrast to pattern matching message handling loops. Another significant feature of Clojure's actors is that the value of an actor is always immediately available for reading without any messages, i.e. observation does not require cooperation/ coordination. This represents, IMO, a substantial reduction in complexity versus other models, but is incompatible with distribution. Clojure actors are integrated with its STM - any messages sent in a transaction are held until it commits, and are discarded if it is retried or aborted. Clojure's actors are reactive - there is no imperative message loop and no blocking receive. Even with actors, Clojure will not yet have a distributed concurrency
Rich You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||