Hi,
I am relatively new to BeanShell, and I was wondering if there was any way to get a reference to a BeanShell closure via Java (Assuming a BeanShell interpreter was embedded)?
 
for example, if my bsh script were:
 
   foo(){
            doSomething();
            return this();
   }
 
I want to be able to do something like this in my java class:
 
   Closure closure = (Closure)interp.get("foo");
   closure.invoke(new Object[]{});// no arguments
 
I tried just using interp.eval("foo()") and getting the XThis object, but I don't want foo to be executed until I call it from the Java code. Having an Interpreter instance running for each Closure doesn't seem like a good idea either.
 
Any suggestions?