> -----Original Message-----
> From: Mo DeJong [mailto:[EMAIL PROTECTED]]
> 
> Please provide an example where the internal rep get hosed inbetween
> the call to java::new and the call to set. This should never happen.

Like I said, it "may or may not" work.  So use at your own risk.  Here is
the example I posted before:

> proc my_proc {arg1 arg2 ...} {
>     ...
>     variable x
>     set x $arg2
>     ...
> }

Call the proc inside Java using Tcl_EvalObjEx(...) with a TclList of Reflect
Objects as the arguments.  $arg2 contains a string instead of the original
Reflect objects.  Original post is attached below.

-- Jiang Wu
   [EMAIL PROTECTED]


-----Original Message-----
From: Jiang Wu 
Sent: Friday, June 23, 2000 4:18 PM
To: 'Mo DeJong'; Jiang Wu
Cc: [EMAIL PROTECTED]
Subject: RE: [Tcl Java] A Tcl or TclBlend problem?


> -----Original Message-----
> From: Mo DeJong [mailto:[EMAIL PROTECTED]]
> Sent: Friday, June 23, 2000 3:15 PM
> To: Jiang Wu
> Cc: [EMAIL PROTECTED]
> Subject: Re: [Tcl Java] A Tcl or TclBlend problem?
>
> You mentioned that doing an after with a list object solved 
> the problem, 
> but here you are using a TclList so it should incr the ref counts of
> the objects in the list. Seems like that should work, I guess I
> do not understand why your method arguments would be getting converted
> to strings instead of TclObjects. Is this something that Interp.eval()
> is doing?

I have a Tcl script text file that looks something this:

proc my_proc {arg1 arg2 ...} {
    ...
    variable x
    set x $arg2
    ...
}

The script is loaded (sourced) into the interpreter upon program startup.
arg2 is supposed to contains a script to be invoked later in a fileevent
handler such as {command arg arg ...}.  All this works fine if "arg2" is a
"normal" Tcl script.

Then I want to pass in a Java command with some Java object arguments to
"arg2" so that a Java method is invoked in the callback.  So I call my_proc
from within Java using a TclList as the 2nd argument and wrap all my Java
objects inside TclObject's.  When the interpreter executes "set x $arg2"
part of the Tcl script, it no longer has the original list.  Inside a
debugger, I can see that the arg2 contains a string representation of the
TclList I passed in.  

My conclusion is that the C version Tcl interpreter is very liberal about
interchanging the string presentation and real object representation.  For
example, if you have a TclList, and you called "TclList.toString()" followed
by "eval(TclList)".  The native Tcl code will use the string version of your
TclList rather than the real list object.  I wonder how Jacl behaves in
similar situation.

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