Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 3ae1e6b18003cdc42fee4c0c7099ca4756fe31d9
Ticket: 3169173fffffffffffffffffffffffffffffffff
crosstalk between arrays
User & Date: msofer on 2011-02-01 19:25:42
Changes

  1. icomment:
    Not sure about what you are trying to do, but: the type/intrep of a Tcl_Obj is just a cache optimising the representation for the *last* usage of this obj. It is *not* really a property of the Tcl_Obj, and is subject to changing (aka shimmering).
    
    In your script, let us follow what happens to 'a':
    
    set foo(b) a
    set bar(a) b
    # 'a' is just a string
    
    foreach i [array names bar] {
           puts "$i : [otype $i]"
    }
    # 'a' has only been ever used used as a string, still a string
    
    set l {}
        foreach {i j} [array get foo] {
           foreach k $j {
              lappend k $l
           }
        }
    # 'a' has been treated as a list by doing [foreach] on it; type is now list
    
    
  2. login: "msofer"
  3. mimetype: "text/plain"
  4. username: "msofer"