Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 4f7fa77a07f4983c6cd9eb24e9ecb1294c963e17
Ticket: 523900ffffffffffffffffffffffffffffffffff
Substituted error stacks
User & Date: nobody on 2002-02-28 16:16:13
Changes

  1. assignee changed to: "msofer"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    (summary of previous discussions with Jeff, Miguel et
    al)
    
    Idea: errorInfo gives only static source-level info
    (line numbers and source excerpts), but not the actual
    arguments gotten by the functions on the stack.
    
    (1) This proposal is about creating a second global
    variable, ::errorStack, which would be primarily a Tcl
    list (until somebody asks for its string rep of
    course), into which we'd stick all the dynamic info we
    miss in errorInfo. The starting point is to store there
    references to the substituted commands-and-args list of
    the calling stack, which are available even at Tcl
    level as [info level $n]. It is easy to do so while
    respecting the current control flow of error stack: at
    each level we store the info pertaining to the current
    level, then we pop back. So this amounts to (in Tcl
    pseudocode):
    
    lappend ::errorStack [info level 0]
    
    at the point where errorInfo is currently being built.
    
    (2) Possible extension to this proposal: faster
    reimplementation of errorInfo, leading to a much faster
    [catch] in the negative (error) case. Principle:
    
    - extend the above mechanism with file and line 
      number info from TIP#86, and store them 
      alongside the [info level]s in errorStack.
    
    - remove all current errorInfo-construction 
      code (especially the line-counting loop !) 
      and reimplement errorInfo with a read trace, 
      reproducing exactly today's syntax but based 
      on the data in errorStack, and only if 
      errorInfo is used (which is not the case of 
      all [catch]es, hence the speed gain !).
    
    I have posted a first step towards this in pure Tcl on
    comp.lang.tcl. But clearly it suffers from all the
    limitations of the current errorInfo construction
    mechanism, which badly interacts with reentrant [eval]
    of the Tcl code in any write trace on errorInfo !
    
    Hence this proposal as a core patch, which would be
    IMHO much more elegant (and simple, and efficient...)
    than this pure-Tcl simulation
    
    
  4. foundin changed to: "None"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "nobody"
  9. subsystem changed to: "07. Variables"
  10. title changed to: "Substituted error stacks"
  11. type changed to: "RFE"