Artifacts Associated With Ticket a122627849
Ticket change [b3f958f339] (rid 135727) by anonymous on 2013-11-22 13:45:46:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/html"
- comment initialized to:
There's a bug in the built-in 'parray' procedure of Tcl 8.4. <br /> The 'parray' procedure check if the variable is an array, and if it is not, then it tries to print it's content instead of it's name. Code example: <pre> proc array_to_list {arr_VarName} { upvar $arr_VarName arr if [array exists arr] { set tmp [array get arr] parray arr unset arr parray arr array set arr [array get tmp] return 1 } return 0 } set b(a) "5" set b(c) "asdas" set b(dd) "al94i" if [array_to_list b] { puts $b } else { puts "BAAAAAAA" } </pre> Output example: <pre> arr(a) = 5 arr(c) = asdas arr(dd) = al94i "arr" isn't an array while executing "error "\"$a\" isn't an array"" (procedure "parray" line 4) invoked from within "parray arr" invoked from within "if [array exists arr] { set tmp [array get arr] parray arr unset arr parray arr array set arr [array get tmp] return 1 }" (procedure "array_to_list" line 3) invoked from within "array_to_list b" invoked from within "if [array_to_list b] { puts $b } else { puts "BAAAAAAA" }" (file ".\test.tcl" line 22) </pre> The line "error "\"$a\" isn't an array"" has the error, which is relevant to the second 'parray arr' line that is in the 'array_to_list' procedure. <br /> ActiveState ActiveTcl <br />8.4.20.0.297203 Jun 05, 2013 - foundin initialized to: "8.4"
- is_private initialized to: "0"
- login: "anonymous"
- priority initialized to: "5 Medium"
- private_contact initialized to: "5d6a65d81064024e292e94471bcec5cccc966f90"
- resolution initialized to: "None"
- severity initialized to: "Minor"
- status initialized to: "Open"
- submitter initialized to: "anonymous"
- subsystem initialized to: "- New Builtin Commands"
- title initialized to: "procedure 'parray' doesn't check for an array"
- type initialized to: "Bug"
Ticket change [b4ec33673c] (rid 135728) by dkf on 2013-11-22 13:58:15:
- assignee changed to: "dkf"
- login: "dkf"
- mimetype: "text/plain"
- priority changed to: "3 Low"
- subsystem changed to: "38. Init - Library - Autoload"
Ticket change [02bcfc780b] (rid 135729) by jan.nijtmans on 2013-11-22 16:05:44:
- icomment:
This error message: "arr" isn't an array looks perfectly OK to me.
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- resolution changed to: "Invalid"
- status changed to: "Pending"
- icomment:
Ticket change [a91adf9e6b] (rid 135735) by dkf on 2013-11-24 17:20:01:
- icomment:
I suppose we could use <tt>return -code error</tt> instead of <tt>error</tt>. Like it's important.
- login: "dkf"
- mimetype: "text/html"
- username: "dkf"
- icomment:
Ticket change [377a37bd72] (rid 135736) by dkf on 2013-11-24 17:37:09:
- icomment:
Actually, it makes sense to make that change; it's not an error in <tt>parray</tt> itself, so much as its caller. It also doesn't break any existing tests in 8.5 (8.4 being closed to changes now…)
- login: "dkf"
- mimetype: "text/html"
- username: "dkf"
- icomment:
Ticket change [454805c0cc] (rid 135739) by dkf on 2013-11-24 18:37:38:
- closedate changed to: "2456621.2761416"
- closer changed to: "dkf"
- icomment:
“Fixed” the error trace message in 8.5 and 8.6. No sense in confusing people unnecessarily.
- login: "dkf"
- mimetype: "text/html"
- status changed to: "Closed"
- username: "dkf"
Ticket change [ce7effe25b] (rid 135740) by jan.nijtmans on 2013-11-24 20:50:22:
- closedate changed to: "2456621.36831343"
- closer changed to: "jan.nijtmans"
- icomment:
Yes that makes sense! Indeed, less confusing. Thanks!
- login: "jan.nijtmans"
- mimetype: "text/plain"