There was some talk about Clojure running on terracotta (www.terracotta.org) which is a distributed JVM (a single JVM instance running on distributed nodes). Depending on how well terracotta can pull it off, clojure's own implementation may remain simple.
However, I am wondering if having a "clojure conscious" distributed version of agents, STM, Threads and the global namespace can prove to be better at efficiency and providing time-memory-network_traffic guarantees to the programmer. Immutability of objects and the design of the global and thread local namespace should reduce implementation hassles a lot.
I will really appreciate some comments.
Pinocchio
Interesting :)
> ;;; erlang.clj -- Clojure wrapper for Erlang's JInterface.
>
> (ns erlang)
>
> ;; YMMV
> (add-classpath "file:///opt/local/lib/erlang/lib/jinterface-1.4/priv/OtpErlang.jar")
Using add-classpath, except at the REPL, is discouraged.
[...]
> ;; atom
> (defmethod to-erlang clojure.lang.Symbol [s]
> (new OtpErlangAtom (str s)))
>
> (defmethod from-erlang OtpErlangAtom [s]
> (symbol (.atomValue s)))
>
> (defmethod to-erlang clojure.lang.Keyword [s]
> (new OtpErlangAtom (subs (str s) 1)))
[...]
I think you want (name s) for both the Symbol and Keyword cases:
user=> (defmulti to-erlang class)
#'user/to-erlang
user=> (defmethod to-erlang clojure.lang.Symbol [s] (name s))
#<MultiFn clojure.lang.MultiFn@14384c2>
user=> (defmethod to-erlang clojure.lang.Keyword [s] (name s))
#<MultiFn clojure.lang.MultiFn@14384c2>
user=> (to-erlang 'symbol)
"symbol"
user=> (to-erlang :keyword)
"keyword"
--
Michael Wood <esio...@gmail.com>