Jython is Python (2.1) written in 100% Java. It byte compiles to Java and is meant to be a scripting language for Java (it integrates very nicely with Java libraries). The idea is to write code using Python syntax to manipulate the vast Java libraries.
Compared with Jacl and TclBlend, Jython isn't so much a scripting language for Java but a different language for the JVM. Its sort of like C++ for the C/Unix API.
Why mention Jython here? Well, like Java, it too can be scripted with Tcl (see TclBlend Roux).
The funny thing is: Jython is an alternative to the Java syntax, not a scripting solution. TclBlend and Jacl for scripting Jython! Oh, my.
-- Todd Coram
Interesting stuff. Todd, please say a few more words on why Jython is not "scripting".
For me, scripting has the following values:
Jython is a general purpose language (IMHO). Let's see how well it scores according to the above criteria:
Let's look at it in Python, Jython, Tcl and Jacl:
Python:
import os os.chdir(dir) for f in os.listdir(dir): os.remove(f) os.chdir('..') os.rmdir(dir)
(NEM: do you really need to change the working directory to do this in Python?)
Jython:
import os os.chdir(dir)
Oops! The os file functions aren't available in Jython... We need to go to Java for this:
Jython (again):
from java.io import File for f in File(dir).listFiles(): File(str(f)).delete() # Notice str(f) is needed: Java types vs Python... File(dir).delete()
Tcl:
file delete -force $dir
Jacl:
file delete -force $dir
-- Todd Coram
snichols Interesting examples. I consider Jython to be a scripting language because it supports duck typing and you can program on the fly using Jython's interpreter. In our office there is a debate going on whether to continue to use Jython or use BeanShell instead for our functional tests. One advantage BeanShell provides for the Java developer is that they really don't need to learn a new language because BeanShell looks just like Java except it supports duck typing, which is a good thing. Duck typing is where you don't have to declare the variable first. You simply can start using it and change its type on the fly. I think all scripting languages have this.
-- RLH
Well "scripting" has been replaced with "dynamic" now. So you basically have either a "static" or a "dynamic" language. Oh and Jython is at 2.2 now.