Re: JSR 223
pmf <phil.frank <at> gmx.de>
2009-08-01 06:00:36 GMT
On Aug 1, 2:36 am, Niels Mayer <nielsma... <at> gmail.com> wrote:
> PS: I've always seen xwiki as the "emacs of webapps" (and wikis)...
> So I'm looking forward to having a real emacsish type language -- clojure
> to extend it via a more appropriate language for scripting.
I'm the author of the JSR 223 bridge for Clojure. At the moment, I
have several uncommitted changes (mainly related to wrapping it up in
a nice OSGi service component (to be used optionally). The Invocable-
stuff is not implemented at the moment, but will be painless to
implement. The Compilable-interface is a bit harder to do, and given
Clojure's AOT compilation, I'm not sure if there's really a use case
(because if you use require within a small script, Clojure will
already out of the box transparently choose a compiled implementation,
given a proper classpath setup). It's not quite the same, but comes
Aside from that, I have some unresolved design issues regarding
isolation of engines; this works differently for Clojure than for
other dynamic languages for the reasons explained below.
Due to the static initialization of the Clojure runtime, it is much
harder to create different independent Clojure-engine instances, since
this would require loading each Clojure-runtime under a separate
classloader, which I am not opposed to, but was unable to implement.
At the moment, I'm using a weird kind of isolation in which each
Clojure-engine runs in its own thread, using a shared runtime, and
bindings are isolated by pushing and popping them.
I'm going to abandon this rather stupid approach and use a simpler
"one namespace per engine"-scheme. This change should (hopefully) be
transparent for little scripts that don't have their own explicit
namespaces. If your scripts use user-defined namespaces, I'll just
assume you break this isolation intentionally (which is true to the
meaning of namespaces, after all).
If anybody would like to look into the classloader-based isolation,
I'd happily to integrate this change (even if this means a severe
startup-overhead for the creation of each engine-instance; it's simply
the proper way to do it).
For production (at least if you plan to have more than one active
engine instance), I'd recommend to wait for either the namespace-based
isolation or (should anybody get involved) the classloader-based
approach. I'll reply to this thread again if one of these approaches