Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: d6549d64dab8c65fd4263da032a9f451a6886539
Ticket: 3169173fffffffffffffffffffffffffffffffff
crosstalk between arrays
User & Date: sehmann on 2011-02-01 02:02:39
Changes

  1. assignee changed to: "msofer"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    It seems like there is some sort of cross talk between arrays.
    
    we are trying to upgrade our system from 8.4.9 to 8.5.9 and this is a blocker.
    
    proc test {} {
        array set foo ""
        array set bar ""
    
        set foo(b) a
        set bar(a) b
    
        foreach i [array names bar] {
            puts "$i : [otype $i]"
        }
    
        set l {}
        foreach {i j} [array get foo] {
           foreach k $j {
              lappend k $l
           }
        }
    
        foreach i [array names bar] {
            puts "$i : [otype $i]"
        }
    }
    
    test
    
    Output:
    a : string
    a : list
    
    array names is returning an element that is a list!  Does not happen if we don't use the "test" proc.
    
    otype is a C function we wrote to print the type of
    the object and is implemented like this:
       if ( obj->typePtr ) {
           char* typeName = obj->typePtr->name;
           Tcl_SetResult(interp, typeName, TCL_VOLATILE);
    
       } else if ( obj->bytes ) {
           Tcl_SetResult(interp, (char*)"string", TCL_STATIC);
    
       } else {
           Tcl_SetResult(interp, (char*)"unknown", TCL_STATIC);
       }
    
  4. foundin changed to: "obsolete: 8.5.9"
  5. is_private changed to: "0"
  6. priority changed to: "5 Medium"
  7. resolution changed to: "None"
  8. status changed to: "Open"
  9. submitter changed to: "sehmann"
  10. subsystem changed to: "10. Objects"
  11. title changed to: "crosstalk between arrays"
  12. type changed to: "Bug"