Sounds like a great idea.  You might also take a look at Rhino.  It's an
implementation of javascript in java.  I use the standalone shell for
interactively prototyping code fragments -- especially stuff involving
regular expressions.  There is some fairly good documentation for
embedding it in java applications.

http://mozilla.org/rhino/

I have no connection to the rhino project, I just find it to be a handy
tool.  Its main advantage over python is that the java-like syntax of
javascript is more familiar to me.  Once I get a code fragment to work
in javascript, translating it to java is trivial.

You might also take a look at entry 7 in the FAQ
(http://jpython.org/docs/faq.html):

"7. Why do weird things sometimes happen in JPython? 

"More likely than not, the problem is with the JIT (Just-in-time)
compiler your JVM is using. JPython acts like a bizarre Java compiler,
taking Python source code and emitting Java bytecode. It's bizarre
because the emitted bytecode doesn't look quite like the way bytecode
would come out of a Java compiler. JITs can sometimes get confused by
this and will often do incorrect and inexplicable things."

Rhino can theoretically have the same problem but it has an option to
disable byte-code generation for scripts which is less drastic than
turning off the JIT for the entire program.

Frank Conradie wrote:
> 
> Hi all
> 
> Just thought I'd let you in on our newest Turbine experiment - JPython
> integration. Why would we want to do such a thing you may be wondering.
> Well, if you've done as much actual web app development with Turbine as we
> have, you may well see the benefits this brings to the dev process:
> 
> * RAD - add/change (Python) actions and screens without recompiling!!! No
> lost sessions/logins/db connections because of reloads, no waiting forever
> for the first page after a reload (especially with our XSL stuff that is not
> cached initially), none of the problems that rapid edit/recompile cycles
> present to multiple coders. Can you say: "edit, save, refresh"?!
> 
> * The JPython interpreter does the work at runtime. Of course, before
> deployment, JPython can be used to compile the Python actions/screens into
> Java class files, so that there's no performance penalty. In fact, JPython
> can "compile" to Java source code if needed!
> 
> * Easier for non-hardcore-Java developers. Now a developer with relatively
> basic Python skills can add actions and screens - just provide them with
> properly designed data objects that encapsulate the business rules/logic,
> and off they go! What's more, they can immediately see what they're doing
> (right or wrong!).
> 
> We're still in the baby stages of development on this stuff, but it sure
> would add a wonderful OPTION to Turbine for developers.
> 
> Please let us know what you think.
> 
> Frank (and Leon)
> 
> ------------------------------------------------------------
> To subscribe:        [EMAIL PROTECTED]
> To unsubscribe:      [EMAIL PROTECTED]
> Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
> Problems?:           [EMAIL PROTECTED]


------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?:           [EMAIL PROTECTED]

Reply via email to