Re: JSR 223

2009-07-31 Thread pmf

On Aug 1, 2:36 am, Niels Mayer  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
pretty close.

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
is implemented.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: JSR 223

2009-07-31 Thread Niels Mayer
http://www.xwiki.org/xwiki/bin/view/Main/ReleaseNotesXWikiEnterprise20M2On
Fri, Jul 31, 2009 at 9:04 AM, Mike  wrote:
>
> Are there plans for Clojure to work in JSR-223 (Java Scripting
> Framework)?  I see a lot of languages up there already.  In fact, the
> only major JVM languages missing are Scala and Clojure.


In
http://groups.google.com/group/clojure/browse_thread/thread/297861670c2f5611
 (orig http://lists.xwiki.org/pipermail/devs/2009-July/013763.html ) I
wrote:

Clojure has a JSR-223 implementation according to:
http://github.com/pmf/clojure-jsr223/tree/master
http://groovy.codehaus.org/JSR-223+access+to+other+JVM+languages
http://sayspy.blogspot.com/2009/03/interacting-between-jvm-lang-here-and.html
I've been told I'd need to "Build the Clojure JSR223 engine from
http://github.com/pmf/clojure-jsr223/tree/master and place it inside
WEB-INF/lib" in order to add Clojure as a scripting language to Xwiki
(alongside existing
velocity/groovyand
jRuby  scripting
implementations). Any special instructions or suggestions or "gotchas" in
creating the clojure jsr223 engine? (I'm still upgrading to Xwiki
2.0M2prior
to starting my clojure experiment, so any prior advice before doing
anything stupid --  e.g. running the jsr223 engine on an incompatible
version of clojure -- would be helpful.)

Niels
http://nielsmayer.com

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.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: JSR 223

2009-07-31 Thread Stuart Sierra

Someone's working on it: http://github.com/pmf/clojure-jsr223/tree/master

-SS


On Jul 31, 12:04 pm, Mike  wrote:
> Sorry if this is a FAQ; couldn't find it on the main site nor in the
> group.
>
> Are there plans for Clojure to work in JSR-223 (Java Scripting
> Framework)?  I see a lot of languages up there already.  In fact, the
> only major JVM languages missing are Scala and Clojure.
>
> Thanks for any info...
> Mike
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---