Skip to content
Tcl Source Code History Of Ticket 2d2a321244
Login

History Of Ticket 2d2a321244

Artifacts Associated With Ticket 2d2a321244

  1. Ticket change [f1457e8942] (rid 170142) by sebres on 2019-03-15 14:18:16:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/x-fossil-wiki"
    4. comment initialized to:
      If frame level is provided as value, it is confused:
      <code><pre style="padding-left:10">
      % proc test {} { puts pr:[info frame [info frame]]; namespace eval ::test {puts ns:[info frame [info frame]]} }; test
        pr:type proc line 1 cmd {info frame [info frame]} proc ::test level 0
        ns:type <b style="color:red">proc</b> line 1 cmd {info frame [info frame]} level 0
      </pre></code>
      totally unexpected type (red marked), imho - should not type be something like "eval" or "namespace" in the second case?
      
      If one gives the 0 (so as current frame level), it works correct:
      <code><pre style="padding-left:10">
      % proc test {} { puts pr:[info frame 0]; namespace eval ::test {puts ns:[info frame 0]} }; test
        pr:type proc line 1 cmd {info frame 0} proc ::test level 0
        ns:type <b style="color:green">eval</b> line 1 cmd {info frame 0} level 0
      </pre></code>
      
      But still worse, the things change also in this case if something else is involved around `info frame` additionally.<br/>
      So adding a `dict get ... type` around confuses it again:
      <code><pre style="padding-left:10">
      % proc test {} { puts pr:[dict get [info frame 0] type]; namespace eval ::test {puts ns:[dict get [info frame 0] type]} }; test
        pr:proc
        ns:<b style="color:red">proc</b>
      </pre></code>
      As well as just usage of set, so set to variable (despite it is compiled in NS) causes completely wrong type recognition:
      <pre style="padding-left:10">
      % proc test {} { namespace eval ::test {puts ns:[info frame 0]} }; test
        ns:type <b style="color:green">eval</b> line 1 cmd {info frame 0} level 0
      % proc test {} { namespace eval ::test {puts ns:[set f [info frame 0]]} }; test
        ns:type <b style="color:red">proc</b> line 1 cmd {info frame 0} level 0
      </pre>
      
      So it looks like `info frame` is totally unusable at the moment (or at least pointing at the wrong frame, if one wants to retrieve the type of the scope).
      
    5. foundin initialized to: "all"
    6. is_private initialized to: "0"
    7. login: "sebres"
    8. priority initialized to: "5 Medium"
    9. resolution initialized to: "None"
    10. severity initialized to: "Severe"
    11. status initialized to: "Open"
    12. submitter initialized to: "sebres"
    13. subsystem initialized to: "16. Commands A-H"
    14. title initialized to:
      info frame does not correct recognize current type of execution scope
      
    15. type initialized to: "Bug"
  2. Ticket change [29437f2451] (rid 170151) by sebres on 2019-03-15 19:21:45:

    1. icomment:
      Partially the behavior may be correct - the documentation about type "proc" says:
      
      <b>proc</b> means that the command is found in <b>dynamically</b> created procedure body.
      
      So I assume, in case it is constructed "statically" from source and compiled (like TCL_LOCATION_BC), info frame just searching the type up to the source and returns it wrapped to the origin type (e. g. using TclGetSrcInfoForPc).
      
      But the upper case (difference by [info frame 0] and [info frame [info frame]] may occur because of the in-place change of interpreter frame levels inside InfoFrameCmd, so it is correct by direct invocation (0) and wrong by 2 commands sequentially. Additionally this is ugly and should be rewritten. WiP.
      
    2. login: "sebres"
    3. mimetype: "text/x-fossil-wiki"