On Tue, 16 Nov 1999, Thomas Down wrote:

> 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

Well, Jacl 1.2.5 already includes a java::import command
so your java::import command would conflict.

>   java::import -statics mypack.SomeClass mypack.Blob
> 
>   # ...
> 
>   set blob [Blob $obj]             # Cast $obj as Blob
>   SomeClass myStaticMethod $blob   # Call a static method

So is the Blob proc defined like this? I guess I am a little
unclear about what your patch does.

proc Blob { obj } {
  return [java::cast Blob $obj]
}

It seems like your SomeClass proc would be defined like this.
Is this correct?

proc SomeClass { method args } {
  eval {java::call SomeClass $method} $args
}

> 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.

Could you provide some more info about what additional
features your changes will provide and the pros and cons
of your modifications?

Thanks
Mo DeJong
 
> 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]'. 

Reply via email to