> -----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".  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 change other people's code this way.  It is
there to demonstrate a more fundamental problem:  "Java objects in Tcl
should be treated as global system resources like file handles (explicit
create/remove) rather than other normal Tcl objects (implicit
create/duplicate/remove)."

> -----Original Message-----
> From: Mo DeJong [mailto:[EMAIL PROTECTED]]
>
> The eval command will convert its arguments to strings.
> This has the effect of removing the Java object from
> the reflect table right before you invoke the Java cmd.

This is my point.  As soon as any Java objects are converted into their
string form.  The Java object from the reflect table would be removed.  It
is not just the "eval" command.  It is the whole Tcl interpreter (maybe the
byte code compiler in particular).  The interpreter seems to change objects
into string form in various places.  The fact that [list eval $x toString]
works under Tcl 8.3.1, but not under Tcl 8.2.3 also demonstrate this.  

I was doing something even simpler:

        proc foo {arg} {
            set x $arg
        }

I call "foo" using an "arg" that was a TclObject with a ReflectObject.  The
debugger shows that the execution of "set x $arg" happening inside the byte
code executor.  The argument is retrieved from the Tcl's procedure stack,
which is just a string only representation of what I passed in.

I had to write my workaround using a string<->object mapping scheme like the
ones used in ReflectObject, but without the reference counting.

-- Jiang Wu
   [EMAIL PROTECTED]

----------------------------------------------------------------
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]'. 
An archive is available at http://www.mail-archive.com/tcljava@scriptics.com

Reply via email to