Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 057aa66c914ada883160e4972d395a8cac232386
Ticket: 652765ffffffffffffffffffffffffffffffffff
errors disappear in trace callbacks
User & Date: vincentdarley on 2004-08-25 21:35:21
Changes

  1. icomment:
    Logged In: YES 
    user_id=32170
    
    I agree it is undesirable to swallow errors, but the
    suggested approach can still lead to inconsistencies. 
    Looking closely, the current variable tracing approach also
    has a similar problem, for example:
    
    set foo 3
    trace add variable foo write {puts "1: foo is $foo" ; #}
    trace add variable foo write {set foo 3 ; error "don't
    change" ; #}
    trace add variable foo write {puts "2: foo is $foo" ; #}
    
    If I now try to 'set foo 2', the last trace fires and thinks
    that foo is 2, but then the next trace actually sets foo to
    3 and throws an error, aborting the change.
    
    The upshot is that one of the traces was confused, and
    believed the variable was set to 2 when it wasn't.
    
    A similar, but more fundamental problem will occur with
    rename traces, if we allow them to be aborted by an error. 
    One trace can think something has been renamed, but then the
    next trace aborts the rename.  Now we are in an inconsistent
    state.
    
    So, as I've said, I'm all for not swallowing errors, but I'm
    not very keen on inconsistent states either.
    
    
    
  2. login: "vincentdarley"
  3. mimetype: "text/plain"
  4. username: "vincentdarley"