Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 99bc00cb3bdb1eb7ca0723a45bef9c1a770f6568
Ticket: 2134049fffffffffffffffffffffffffffffffff
info frame documentation error
User & Date: lars_h on 2008-09-28 12:11:14
Changes

  1. assignee changed to: "dkf"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    The description of what [info frame] does when given a positive level argument is as follows:
    
      If number is positive (> 0) then it selects a particular 
      stack level (1 refers to the top-most active command, 
      i.e., info frame itself, 2 to the command it was called 
      from, and so on)
    
    However, [info frame] is in practice almost never the top-most active command, so this is wrong. Defining
    
    proc nest {levels} {
      if {$levels<1} then {
        for {set n 1} {$n<=[info frame]} {incr n} {
          puts [format {%d: %s} $n [info frame $n]]
        }
      } else {
        nest [incr levels -1]
      }
    }
    
    one gets
    
    % nest 3
    1: type eval line 1 cmd {nest 3} level 4
    2: type proc line 7 cmd {nest [incr levels -1]} proc ::nest level 3
    3: type proc line 7 cmd {nest [incr levels -1]} proc ::nest level 2
    4: type proc line 7 cmd {nest [incr levels -1]} proc ::nest level 1
    5: type proc line 4 cmd {info frame $n} proc ::nest level 0
    
    i.e., it is [info frame [info frame]] that selects the info frame call itself.
    
    Also wrong is the claim that [info frame 2] provides information about the command from which [dict get [info frame 1] cmd] was called, since the above shows it is really the other way around: [dict get [info frame 1] cmd] caused [dict get [info frame 2] cmd] to be called.
    
    The corresponding sentence in the description of [info level] describes these relationships correctly:
    
      If number is positive then it selects a particular stack level 
      (1 refers to the top-most active procedure, 2 to the 
      procedure it called, and so on);
    
    Possibly it is the use of "top-most" that confuses the issue (does the stack grow top to bottom or bottom to top?), so maybe it would be a good idea to replace this term by "outermost".
    
    An alternative wording is:
    
      If number is positive then it selects a particular 
      stack level (1 refers to the outermost active procedure, 
      2 to the procedure it called, and so on, up to the current 
      frame level which refers to the info frame itself);
    
    
    
  4. foundin changed to: "obsolete: 8.5.4"
  5. is_private changed to: "0"
  6. priority changed to: "5 Medium"
  7. resolution changed to: "None"
  8. status changed to: "Open"
  9. submitter changed to: "lars_h"
  10. subsystem changed to: "17. Commands I-L"
  11. title changed to: "info frame documentation error"
  12. type changed to: "Bug"