Artifacts Associated With Ticket 3169173fffffffff
Ticket change [d6549d64da] (rid 123782) by sehmann on 2011-02-01 02:02:39:
- assignee initialized to: "msofer"
- cmimetype initialized to: "text/plain"
- 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); } - foundin initialized to: "obsolete: 8.5.9"
- is_private initialized to: "0"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "sehmann"
- subsystem initialized to: "10. Objects"
- title initialized to: "crosstalk between arrays"
- type initialized to: "Bug"
Ticket change [3ae1e6b180] (rid 112637) by msofer on 2011-02-01 19:25:42:
- 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 - login: "msofer"
- mimetype: "text/plain"
- username: "msofer"
- icomment:
Ticket change [db5082f16a] (rid 107938) by msofer on 2011-02-01 19:25:43:
- closedate changed to: "2011-02-01T12:25:43"
- closer changed to: "msofer"
- icomment:
allow_comments - 1
- login: "msofer"
- mimetype: "text/plain"
- resolution changed to: "Invalid"
- status changed to: "Closed"
- username: "msofer"
Ticket change [2a4e40416d] (rid 118532) by msofer on 2011-02-01 19:26:52:
- icomment:
allow_comments - 0
- login: "msofer"
- mimetype: "text/plain"
- username: "msofer"
- icomment:
Ticket change [d776f6e4a4] (rid 123993) by sehmann on 2011-02-03 02:49:57:
- icomment:
Thanks Miguel, that clarifies things and helps us know how to handle the various types that come into our commands.
- login: "sehmann"
- mimetype: "text/plain"
- username: "sehmann"
- icomment: