When I developed PnutsClassLoader, I realized that scripting-language-specific ClassLoader is another interface to scripting languages. GroovyClassLoader is one. I am not sure if Jython has such ClassLoader. As an experiment, I wrote JavaCompilerClassLoader that parses a Java source file and compiles it on-the-fly using JSR199 API.
By the way, in my latest project, I used PnutsClassLoader to define classes in Pnuts. For instance,
package mypackage
import java.util.HashMap
class int_map extends HashMap {
get(key){
if ((v = super.get(key)) == null){
super.put(key, v = new int[1])
}
v[0]
}
put(key, value){
if ((v = super.get(key)) == null){
super.put(key, v = new int[1])
}
v[0] = value
}
}
This class is defined in "mypackage/int_map.pnc" ; ".pnc" is the standard extension for class definition files in Pnuts. I put this file in a WAR file.
With this class script, it was easier to count items in a hash table.
e.g.
total = new mypackage.int_map()
total[key] += count