[Tcl Java] Re: [Tcl Java] Re: [Tcl Java] Re: [Tcl Java] Re: [Tcl Java] Re: [Tcl Java] Small test case

2000-06-28 Thread Dr Wes Munsil
Mo DeJong wrote: > There is no "compile time" in Tcl, it is all dynamic, ... Exactly my point. Consider these two code snippets, which I assume you agree are correct uses of newInstance(): B x = new C (); ReflectObject.newInstance (interp, B.class, x); C x = new C (); ReflectObject.newInstanc

[Tcl Java] RE: [Tcl Java] Re: [Tcl Java] Re: [Tcl Java] A Tcl or TclBlend pr oblem?

2000-06-28 Thread Mo DeJong
On Wed, 28 Jun 2000, Jiang Wu wrote: > But the script does work under Tcl 8.3.1. I need to point out that my 2nd > script is NOT a "workaround". It is not a workaround because you can't > convert all callback scripts into this list form; it is not the normal way > of writing Tcl; and you can't

[Tcl Java] Re: [Tcl Java] Re: [Tcl Java] Re: [Tcl Java] Re: [Tcl Java] Small test case

2000-06-28 Thread Mo DeJong
On Wed, 28 Jun 2000, Dr Wes Munsil wrote: > Perhaps what you mean is that the class passed to ReflectObject.newInstance() must > identify the _type_ of the _expression_ that is the third argument (sometimes called >the > compile-time type), not the _class_ of the _object_ referred to by that exp

[Tcl Java] Re: [Tcl Java] Re: [Tcl Java] Re: [Tcl Java] Small test case

2000-06-28 Thread Mo DeJong
On Wed, 28 Jun 2000, Dr Wes Munsil wrote: > Yes, in Java, I need to know the class of an object in a vector, so I can cast it >back > to that class if I need to call any of that class's methods. getClass() tells me >exactly > that. So if that is incorrect in TclBlend, there must be something el

[Tcl Java] Re: [Tcl Java] Re: [Tcl Java] Re: [Tcl Java] Small test case

2000-06-28 Thread Dr Wes Munsil
Mo DeJong wrote: > It depends on what you are doing. In regular Java, you need to know > what the type of the objects you put into a vector are because > you need to cast them back up to something when you pull them > out of the vector. TclJava is no different, you just put the > class you would

[Tcl Java] Re: [Tcl Java] Re: [Tcl Java] Re: [Tcl Java] Small test case

2000-06-28 Thread Mo DeJong
On Wed, 28 Jun 2000, Dr Wes Munsil wrote: > Mo DeJong wrote: > > > Objects do not have types, references to objects determine what behavior > > the object will provide. In Tcl/Java you don't really have a reference > > but you "reflect" an object as a type. You need to pass in the > > java.lang.

[Tcl Java] Re: [Tcl Java] Re: [Tcl Java] Re: [Tcl Java] Small test case

2000-06-28 Thread Dr Wes Munsil
Mo DeJong wrote: > Objects do not have types, references to objects determine what behavior > the object will provide. In Tcl/Java you don't really have a reference > but you "reflect" an object as a type. You need to pass in the > java.lang.Class object that a given java.lang.Object will be refl

[Tcl Java] RE: [Tcl Java] Re: [Tcl Java] Re: [Tcl Java] A Tcl or TclBlend problem?

2000-06-28 Thread Jiang Wu
> -Original Message- > From: Dr Wes Munsil [mailto:[EMAIL PROTECTED]] > > Yes, but if you read on you will see that I also tried your proposed > workaround, and it gave the same error. But the script does work under Tcl 8.3.1. I need to point out that my 2nd script is NOT a "workaround".

[Tcl Java] Re: [Tcl Java] Re: [Tcl Java] A Tcl or TclBlend problem?

2000-06-28 Thread Dr Wes Munsil
Yes, but if you read on you will see that I also tried your proposed workaround, and it gave the same error. Jiang Wu wrote: > Your log says: > > > % fern > > bgerror failed to handle background error. > > Original error: invalid command name "java0x1" > ^^^

[Tcl Java] RE: [Tcl Java] Re: [Tcl Java] A Tcl or TclBlend problem?

2000-06-28 Thread Jiang Wu
Your log says: > % fern > bgerror failed to handle background error. > Original error: invalid command name "java0x1" ^^ > Error in bgerror: invalid command name "bgerror" Is that not the same error you encountered? -- Jiang Wu

[Tcl Java] Re: [Tcl Java] global variable access

2000-06-28 Thread Mo DeJong
On Wed, 28 Jun 2000, Frank Krahmer wrote: > I have a question regarding access of global variables : > > I have two tcl-scripts : > > 1.) init.tcl : > > package require java > proc init {} { > # create global variable > set teststring [java::new String "abcabc"] > } > > 2.) access

[Tcl Java] global variable access

2000-06-28 Thread Frank Krahmer
I have a question regarding access of global variables : I have two tcl-scripts : 1.) init.tcl : package require java proc init {} { # create global variable set teststring [java::new String "abcabc"] } 2.) access.tcl : package require java proc access {} { set resstr

[Tcl Java] Re: [Tcl Java] Re: [Tcl Java] RE: [Tcl Java] Small test case

2000-06-28 Thread Mo DeJong
On Wed, 28 Jun 2000, Dr Wes Munsil wrote: > I think the implication is that it is simply not safe to do what I have done, > which is attempt to use a Tcl list to iterate over Java objects. You must use > Java iteration mechanisms instead (e.g. java.util.Enumeration). No, that should work just fi

[Tcl Java] Re: [Tcl Java] Re: [Tcl Java] A Tcl or TclBlend problem?

2000-06-28 Thread Mo DeJong
On Wed, 28 Jun 2000, Dr Wes Munsil wrote: > Am I missing something? I do not see this behavior in the 8.2.3 Tcl shell: > > % proc fern {} { > set x [java::new String foo] > after 1 "$x toString" > unset x > update > } > % fern > bgerror failed to handle background error. > Original error

[Tcl Java] Re: [Tcl Java] RE: [Tcl Java] Small test case

2000-06-28 Thread Dr Wes Munsil
I think the implication is that it is simply not safe to do what I have done, which is attempt to use a Tcl list to iterate over Java objects. You must use Java iteration mechanisms instead (e.g. java.util.Enumeration). Jiang Wu wrote: > The problem is that the code assumes > > set dataList [m

[Tcl Java] Re: [Tcl Java] A Tcl or TclBlend problem?

2000-06-28 Thread Dr Wes Munsil
Am I missing something? I do not see this behavior in the 8.2.3 Tcl shell: % proc fern {} { set x [java::new String foo] after 1 "$x toString" unset x update } % fern bgerror failed to handle background error. Original error: invalid command name "java0x1" Error in bgerror: invalid co