Does it make sense to just have one main dynamic language interface --
groovy -- and then access other jvm langs through groovy? e.g.:
http://groovy.codehaus.org/JSR-223+access+to+other+JVM+languages
http://svn.codehaus.org/groovy/tags/cc/build.2126/src/wiki-snapshot.pdf
Calling Scala from Groovy
First write a Scala class:
Complex.scala
class Complex(real: double, imaginary: double) {
def re = real
def im = imaginary
override def toString() = "" + re + (if (im < 0) "" else
"+") +
im + "i"
}
Compile this using scalac:
scalac Complex.scala
Now write our Groovy Program:
ComplexMain.groovy
println new Complex(1.2, 3.4)
Now run the program (assuming scala-library.jar is in the CLASSPATH):
groovy ComplexMain
Which produces:
1.2+3.4i
Note that in this example it would have been just as easy to write our
Complex class using Groovy as follows:
class Complex {
def re, im
Complex (double real, double imaginary) {
re = real
im = imaginary
}
String toString() { "$re" + (im<0 ? '' : '+') + im
+ 'i' }
}
but in other cases you may have some existing Scala classes you wish to
reuse from Groovy.
Also note my interest in using Clojure with Xwiki:
http://www.mail-archive.com/devs@xwiki.org/msg10589.html
and an interesting response from the author of
http://github.com/pmf/clojure-jsr223 :
http://groups.google.com/group/clojure/msg/ad811b69d448e3db
Due to lack of time, and overcommitment, I decided it would be best to let
Xwiki and Clojure and JSR 223 mature some more, and learned to program in
groovy instead (because it works and is "mature" in its xwiki
integration)...
-- Niels.
http://nielsmayer.com