It looks like Tcl Blend is returning a new value everytime I do a get() on
a LinkedList.  This is confusing because Java returns the same value that
I passed in to the list

In this simple Java class, I create a LinkedList, then add a
GregorianCalendar to the list.  When I get the GregorianCalendar
object back from the List, it is a pointer to the same object as
what I passed in.

bash-2.02$ cat T.java
import java.util.*;
public class T {
    static void main(String v[]) {
        LinkedList l = new LinkedList();
        GregorianCalendar cal = new java.util.GregorianCalendar();
        l.add(0, cal);
        System.out.println( (cal == l.get(0)));
    }
}
bash-2.02$ javac T.java
bash-2.02$ java T
true

In this Tcl Blend 1.1.1 version with JDK1.2 under NT4, the
java0x value that I get back from the list is not the
same as what I passed in.  Note that each time
I call get, I get a different java0x value.  I believe
that Under Tcl Blend 1.0, I got the same value 
as what I passed in.

bash-2.02$ cat /tmp/t.tcl
set l [java::new java.util.LinkedList]
set cal [java::new java.util.GregorianCalendar]
$l add  0 cal
puts "[expr { $cal == [$l -noconvert get 0]}]"
puts "cal = $cal"
puts "\[$l get 0\] = [$l -noconvert get 0]"
puts "\[$l get 0\] = [$l -noconvert get 0]"
bash-2.02$

bash-2.02$ tclsh80
sourcing /users/cxh/tclshrc.tcl
% package require java
1.1.1
% source /tmp/t.tcl
0
cal = java0x2
[java0x1 get 0] = java0x4
[java0x1 get 0] = java0x5
%

-Christopher

----------------------------------------------------------------
The TclJava mailing list is sponsored by WebNet Technologies.
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]'. 
A list archive is at: http://www.findmail.com/listsaver/tcldallas/

Reply via email to