Artifacts Associated With Ticket 3599906fffffffff
Ticket change [25a7dc9f24] (rid 88207) by heinrichmartin on 2013-01-08 08:52:22:
- assignee initialized to: "dkf"
- cmimetype initialized to: "text/plain"
- comment initialized to:
"dict keys" takes a dictionaryVALUE, but affects the variable's interpretation by foreach: expect:/tmp$ set tcl_version 8.5 expect:/tmp$ set x {1 a 2 b 3 c 3 d 3 e} ;# store a list which also is a dictionary value 1 a 2 b 3 c 3 d 3 e expect:/tmp$ foreach {key val} $x {puts "$key -> $val"} ;# print pairs of list elements correctly 1 -> a 2 -> b 3 -> c 3 -> d 3 -> e expect:/tmp$ dict keys $x ;# the argument is passed by value, isn't it? (see dict or the dodekalogue) 1 2 3 expect:/tmp$ foreach {key val} $x {puts "$key -> $val"} ;# we had that very command, and x was not altered. 1 -> a 2 -> b 3 -> e expect:/tmp$ set x ;# indeed, x was not altered 1 a 2 b 3 c 3 d 3 e Obviously, variables are stored in best-guess-data-structures (lists, dictionaries, ...) whenever a corresponding command is used. This performance benefit must not affect consistency. Why does foreach treat dict-variables differently? This should not happen, we do have "dict for"! - foundin initialized to: "obsolete: 8.5.13"
- is_private initialized to: "0"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "heinrichmartin"
- subsystem initialized to: "15. Dict Object"
- title initialized to: "dict command has side effects on foreach"
- type initialized to: "Bug"
Ticket change [0f11837d41] (rid 94728) by dkf on 2013-01-08 18:09:29:
- closedate changed to: "2013-01-08T11:09:29"
- closer changed to: "dkf"
- icomment:
This looks like a dupe of 3004007 and that was fixed a few years ago (in time for 8.5.9). What does [info patchlevel] report for a buggy run? I can't duplicate using your exact code with the tip of the 8.5 branch...
- login: "dkf"
- mimetype: "text/plain"
- resolution changed to: "Duplicate"
- status changed to: "Pending"
- username: "dkf"
Ticket change [28ada1b3ab] (rid 88738) by heinrichmartin on 2013-01-08 20:36:11:
- foundin changed to: "obsolete: 8.5.8"
- icomment:
My bad, I did not consider the bugfix version. We are running Debian Squeeze stable and it looks like it's finally time for backports. I leave it to you to close the ticket. Thanks for the help, I did not find the duplicate as it does not contain "foreach". Sorry!
- login: "heinrichmartin"
- mimetype: "text/plain"
- status changed to: "Open"
- username: "heinrichmartin"
Ticket change [97694a0276] (rid 106491) by dkf on 2013-01-08 20:46:49:
- icomment:
This artifact has been marked as a duplicate of artifact 3004007 with reason: older version under test than expected
- login: "dkf"
- mimetype: "text/plain"
- username: "dkf"
- icomment:
Ticket change [34497077e9] (rid 106735) by dkf on 2013-01-08 20:46:50:
- status changed to: "Closed"