Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 6d7ed4afadeed161aac265292a13d6f358ccd8e3
Ticket: 2811381fffffffffffffffffffffffffffffffff
unexpected 'result' in trace execution leave
User & Date: anonymous on 2014-09-23 11:07:39
Changes

  1. closer changed to: "nobody"
  2. comment changed to:
    trace manpage says:
    For leave and leavestep operations: command command-string code result op
    [...] result [gives] the result string.
    When multiple traces are set on name, then [...] for leave and leavestep operations, the traced commands are invoked in the original order of creation.
    
    However, it doesn't say that the 'result' is taken from original command only for first trace. Each following trace takes 'result' from previous traced command. This is not completely unwanted, but rather unexpected. For multiple traces, each of them has to return it's 'result' argument, in other case next trace might fail. Manual should be clearer on that.
    
    Example:
    % proc traced {} {return hello}
    % proc trace_1st {cmdstr code result op} {puts "first: $result"; return first}
    % trace add execution traced leave trace_1st
    % traced
    first: hello
    hello
    % proc trace_2nd {cmdstr code result op} {puts "second: $result"; return second}
    % trace add execution traced leave trace_2nd
    % traced
    first: hello
    second: first
    hello
    %
    
  3. foundin changed to: "8.6.2"
  4. login: "anonymous"
  5. mimetype: "text/plain"
  6. severity changed to: "Minor"