Agreed, but also:
- The ISeq abstraction
- Software Transactional Memory for state management
- Structure-sharing of the persistent structures, for added efficiency/performance
And of course, all the nice reader macros that make things so much easier to read.
This project is cool, but what I'd rather see is Clojure becoming parasitic, living on all the host VMs it can. We've got the CLR version, and ClojureScript for V8/JS, but we could also have it properly on top of Python, Ruby[1], Lua, Erlang, and LLVM.
[1]: I know Rouge exists, but I'm not sure how well it's progressing.
Apparently implementing Clojure on the LLVM is no easy feat though; judging from references to previous discussions on the mailing list. [1] There is some work on it already though [2,3,4] and I'm sure we'll get there eventually.
[1] https://groups.google.com/forum/#!topic/clojure-dev/bex25u9h... [2] https://github.com/ohpauleez/cljs-terra [3] https://github.com/halgari/clojure-metal [4] https://github.com/halgari/mjolnir
A real compiler backend takes a bit more than a weekend project, and it is hard to know the real reasons, technical or personal life of the coders, for the current state of the projects.
I think the structural sharing is the definition of persistent data structures, as distinct from immutable data structures in general.
Oh, yes, you are very much correct. I just wanted to highlight that is itself a feature of Clojure's behavior.
I am not familiar with elisp but from first google result it reads that the equivalent is alter! / swap!.
(deftype SomeTypeWithMutableFields [^:unsynchronized-mutable some-mutable-field ^:volatile-mutable another-mutable-field])
:unsynchronized-mutable corresponds to a normal mutable Java variable, and :volatile-mutable corresponds to a Java variable with the volatile modifier.
They are private by default, you can only set! them within the lexical scope of the deftype definition. If you needed to expose fast host mutation to the public, I would create a setter/getter interface (via definterface) and implement it on your deftype and use set! locally to mutate the field there.