views:

152

answers:

6

I am looking for a scripting language that meets the following criteria:

  • Well Documented
  • Implemented in Java
  • Understands Datatypes (can handle longs, strings, etc)
  • Is fully extensible

Any suggestions? Currently, I'm using Javascript, but the Doubles that it sets numbers to is not big enough for the data work I'm doing.

Thanks!

+1  A: 

Scala?

Jacob B
A: 

LuaJava could be it. All numbers are represented internally as doubles in lua.

sean riley
oops.. it is not implemented in java.
sean riley
+2  A: 

Python and Ruby have Java implementations (look for Jython and JRuby).

subtenante
+4  A: 

Groovy

In particular, Groovy can be used as a scripting language, but doesn't have to be, and is built on top of Java. It isn't a Java port of a different language, which means it integrates more closely with Java than JRuby/Jython, although that may have changed since I last looked at them.

As for documentation for Groovy, you may want to buy Groovy in Action (plug plug ;)

Jon Skeet
In what ways does Groovy integrate more closely with Java than Jython? I can quite easily call Java code from Jython and vice versa. I can even create Jython classes that implement Java interfaces, instantiate those classes to create Jython objects, and pass those objects into any Java method that is expecting the interface. Isn't the difference between Groovy and Jython largely about what syntax you prefer and whether or not you need Jython's large out-of-the-box library or support functions?
Clint Miller
@Clint: From what I remember, there were some differences between how Python handled strings and how Java did... but I could certainly be wrong, or it could just be that Jython has moved on a lot. I'd *expect* there to be a certain amount of impedance mismatch between Jython and Java, as it's trying to merge two platforms. (There are some impedance mismatches between IronPython and .NET, for instance, where exceptions are translated and the like.) I'm not trying to "diss" Jython at all, just raising some concerns. If they're unfounded, that's great :)
Jon Skeet
@Keith: Another good thing about groovy, as you mentioned in your question, is that groovy uses arbitrary precision decimal numbers (ie: http://groovy.codehaus.org/Groovy+Math).
toolkit
A: 

I'm not sure what you mean by "understands data types". If you mean that it has strings, numbers, etc, then JavaScript, Groovy, Python, and Ruby are some of the many languages that integrate well with Java. If you're looking for a statically typed language, I'm not sure.

Regarding you problem of doubles not being big enough in JavaScript, you can allocate Java BigDecimal objects (or BigInteger objects) from within your JavaScript code. So, number representation shouldn't be an issue for you.

Clint Miller
A: 

What do you mean "Doubles that it sets numbers to is not big enough for the data work I'm doing." Doubles are the same size in most languages AFAIK.

How much precision do you need? Perhaps BigDecimal is for you if you need more than about 16 digits of precision.

Peter Lawrey