Yesterday, Rich Hickey announced the birth of Clojure - a lisp dialect for the JVM. After just a brief look, Clojure is perhaps the most interesting language in the (now fairly large) family of 'dynamic languages for the JVM'. It brings the power of Lisp to the JVM but have made some design decisions that in some ways makes it more interesting than ANSI Common Lisp. Here are some of the things that I find particularly interesting:
- Allows pure functional programming with immutable state (with immutable data-structures etc.) for side-effect-free code (possible in CL but hard to enforce).
Great support for concurrent programming:
- Immutable state can be freely shared across threads.
- Software Transactional Memory (STM) that allows atomic and isolated updates to mutable state (through "Refs") with rollback and retry upon collision.
- Safe usage of mutable state through thread isolation (using "Vars").
- Full Lisp-style macro support and eval.
- Compiles to JVM bytecode but still fully dynamic (sounds promising but I don't know its actual performance).
- Excellent integration with Java APIs, with type inference for static compilation of Java API calls.