Overview
| Artifact ID: | 8a03545e3a889e77ffb57b69fac2a98a796e1666 |
|---|---|
| Ticket: | 197e2bf85c08b9f468b764c30fab2f3c549592da
info frame 'level' does not match documentation |
| User & Date: | anonymous on 2013-07-14 07:53:48 |
Changes
- assignee changed to: "nobody"
- closer changed to: "nobody"
- cmimetype changed to: "text/plain"
- comment changed to:
This is probably an error in the documentation, not in the command. "info frame" returns a dict with a 'level' entry, defined as > level > This entry is present only if the queried frame has a corresponding frame returned by info level. > It provides the index of this frame, relative to the current level (0 and negative numbers). That isn't what actually happens. What happens appears to be: 1. The level is indeed a relative level, but uses the convention of 'uplevel', not 'info level', namely 0 or a positive number. 2. "corresponding" is rather vague, but it seems more accurate to say that 'level' is the caller's level rather than the level of the frame itself. 3. As far as I can tell, 'level' is always present. Taken together, this is sufficiently different that the actual values are hard to interpret. Example: set x 10 proc tst {x} { incr x eval eval tst2 $x } proc tst2 {x} { incr x set depth [info level] for {set i $depth} {$i > 0} {incr i -1} { set rel [expr $i - $depth] puts "level $i ($rel) = [info level $i]" } set depth [info frame] for {set i $depth} {$i > 0} {incr i -1} { set frame [info frame $i] set level [dict get $frame level] set rel [expr $i - $depth] puts "frame $i ($rel) -> level $level ([dict get $frame cmd])" } } When called as "tst $x" this prints level 2 (0) = tst2 11 level 1 (-1) = tst 10 frame 5 (0) -> level 0 (info frame $i) frame 4 (-1) -> level 1 (tst2 11) frame 3 (-2) -> level 1 (eval tst2 11) frame 2 (-3) -> level 1 (eval eval tst2 $x) frame 1 (-4) -> level 2 (tst $x) From the documentation, I expected frame 5 -> (no level) frame 4 -> level 0 frame 3 -> (no level) frame 2 -> (no level) frame 1 -> level -1 However, if you try to use 'uplevel' to determine what the values of $i and $x are in the commands, then it turns out the returned levels are exactly right: add puts "[uplevel $level subst [list [dict get $frame cmd]]]" to the above loop. -Marcel van der Goot - foundin changed to: "8.6.0"
- is_private changed to: "0"
- login: "anonymous"
- priority changed to: "5 Medium"
- private_contact changed to: "f911612b13fc724ee2ff97acb8261b48c1b25f3c"
- resolution changed to: "None"
- severity changed to: "Important"
- status changed to: "Open"
- submitter changed to: "anonymous"
- subsystem changed to: "- New Builtin Commands"
- title changed to: "info frame 'level' does not match documentation"
- type changed to: "Bug"