From: Ype K. <yk...@xs...> - 2001-04-21 09:47:29
|
Adam, you wrote: >Hello, > I'm new to jython, and I have a rather ornate >question about its capabilities, that I have not been >able to determine the answer to by reading docs. I am >looking to supplement my program with a >very-high-level language to aid development in a >certain region. Ideally, the language would be able to >satisfy the following characteristics > >1) Extend java classes (note that these classes will >be leaves in my inheritence tree; java does not need >to be able to extend my jython classes) Make sure your java classes are on the class path when invoking Jython. Then use the following Jython code: import yourpackage someobj = yourpackage.yourclass() class subclass(yourpackage.yourclass): pass etc. >2) Run in interpretted mode, reading from a text file >(that is, without compilation) > >3) Have the same class compile 'dynamically' down to >java bytecode (note that this can take several >seconds, it must merely be possible) You get both in one go. When a jython module is loaded an internal java class is (quite quickly) built to represent the module. This class is also saved for further use. The Jython function execfile() does all of this, you can also do it directly from your own Java code. >4) Reload compiled classes if they are redefined You can drop modules from sys.modules and reimport them. This might leave the old java classes in memory, though. For serious stuff have a look at: http://jython.sourceforge.net/docs/jreload.html You'll need Java 1.2 for best reloading. In any case you will have to detect the need for reloading yourself (the linecache module is a nice example). >How much of this is possible with Jython as it >currently stands? How much of this is possible within >the Jython framework, in an ideal world (that is, if I >was to look at implementing it myself)? Are there >other languages I should be looking at? Apart from reloading: 100%. Reloading takes some involvement, but you probably can get a satisfactory result. Other languages: there are other scripting languages in Java, but I have no experience with them. In case you need references let me know. >I thank you in advance, My pleasure. Ype Kingma |