I've been using JaCL for some time, largely for running simple
scripts which generate reports from biological databases. Looking
through my code, I find that I'm using rather a large number of
java::call commands, and also some java::cast.
I've written a simple patch for JaCL (should also work with
TclBlend, I guess) which allows you to create a new Tcl command
for each java class which you import. This provides an easy
approach to casting, e.g.:
package require java
java::import -statics mypack.SomeClass mypack.Blob
# ...
set blob [Blob $obj] # Cast $obj as Blob
SomeClass myStaticMethod $blob # Call a static method
There are still a few unresolved issues (what happens
if you want to do this with a class in java.lang, for
instance?), but it does seem to tidy up my code rather
a lot, and I suspect could benefit many other users, too.
Does anyone know of any particular reason why this feature
shouldn't be added to mainstream releases? If anyone is
interested, I'll tidy up my patches and sent a copy.
Thomas.
----------------------------------------------------------------
The TclJava mailing list is sponsored by Scriptics Corporation.
To subscribe: send mail to [EMAIL PROTECTED]
with the word SUBSCRIBE as the subject.
To unsubscribe: send mail to [EMAIL PROTECTED]
with the word UNSUBSCRIBE as the subject.
To send to the list, send email to '[EMAIL PROTECTED]'.