Skip to content
Tcl Source Code History Of Ticket 3169173fffffffff
Login

History Of Ticket 3169173fffffffff

Artifacts Associated With Ticket 3169173fffffffff

  1. Ticket change [d6549d64da] (rid 123782) by sehmann on 2011-02-01 02:02:39:

    1. assignee initialized to: "msofer"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized 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 initialized to: "obsolete: 8.5.9"
    5. is_private initialized to: "0"
    6. priority initialized to: "5 Medium"
    7. resolution initialized to: "None"
    8. status initialized to: "Open"
    9. submitter initialized to: "sehmann"
    10. subsystem initialized to: "10. Objects"
    11. title initialized to: "crosstalk between arrays"
    12. type initialized to: "Bug"
  2. Ticket change [3ae1e6b180] (rid 112637) by msofer on 2011-02-01 19:25:42:

    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"
  3. Ticket change [db5082f16a] (rid 107938) by msofer on 2011-02-01 19:25:43:

    1. closedate changed to: "2011-02-01T12:25:43"
    2. closer changed to: "msofer"
    3. icomment:
      
      
      allow_comments - 1
      
      
      
    4. login: "msofer"
    5. mimetype: "text/plain"
    6. resolution changed to: "Invalid"
    7. status changed to: "Closed"
    8. username: "msofer"
  4. Ticket change [2a4e40416d] (rid 118532) by msofer on 2011-02-01 19:26:52:

    1. icomment:
      
      
      allow_comments - 0
      
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  5. Ticket change [d776f6e4a4] (rid 123993) by sehmann on 2011-02-03 02:49:57:

    1. icomment:
      Thanks Miguel, that clarifies things and helps us know how to handle the various types that come into our commands.
      
      
    2. login: "sehmann"
    3. mimetype: "text/plain"
    4. username: "sehmann"