Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 990efd8cb4da283a818d43bafea7919917e988f8
Ticket: 1397843fffffffffffffffffffffffffffffffff
write trace on ::errorInfo is broken
User & Date: pcmacdon on 2006-01-07 04:55:35
Changes

  1. icomment:
    Logged In: YES 
    user_id=190660
    
    Multiple errorInfo trace firings don't bother me.
    Nor do eliminated duplicates.  But failure
    to fire at all when errorInfo changes is a problem as
    the [trace] man page defines behavior for write as:
    
      "For write traces, command is invoked  after
      the variable's value has been changed"
    
    I've done a bit of experimentation on 8.5a3, and
    the half-backed approach works well enough for my purpose.
    But I suspect that doing TclObjLookupVar() every-time
    is less efficient than you had in mind when refactoring?
    Perhaps the var lookup could be cached
    (maybe hooking into the EstablishErrorInfoTraces() call)?
    If so then wouldn't TclCallVarTraces() be efficient enough
    as a means of "detecting" write traces?
    I really don't know enough about in-core details of
    variables to really comment knowledgeably about caching them.
    
    Lastly, the question of how often to trigger: I would think
    that at least once per Tcl_AddObjErrorInfo() is probably best.
    This allows the trace handler to follow the stack
    unwind to perform custom logic.  For example
    it could collect [info locals] at each level of the unwind.
    If that is too inefficient, then minimally the first
    call to Tcl_AddObjErrorInfo() in a stack unwind.
    Though how you would detect that it's the first is beyond me,
    and its not as powerful.
    
    I would be most happy if this could somehow be solved.
    Let me know if I can do or test anything to help out.
    Incompatible behavior (numbers of firings) is far less
    of an issue for me than lack of firing, because it takes
    away one of Tcl's best debugging capability.
    
    
    
  2. login: "pcmacdon"
  3. mimetype: "text/plain"
  4. username: "pcmacdon"