Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 3aaa8bc65e693d1592d06e7b478d1787aac84fb6
Ticket: 231259ffffffffffffffffffffffffffffffffff
shadowing byte-compiled commands
User & Date: msofer on 2001-11-29 21:42:49
Changes

  1. closedate changed to: "2001-11-29T14:42:49"
  2. closer changed to: "msofer"
  3. icomment:
    Logged In: YES 
    user_id=148712
    
    A simpler example (will go into the tests) is:
    
    namespace eval test {variable b 0}
    
    proc test::a {i} {
        variable b
        proc set args {return "New proc is called"}
        return [set b $i]
    }
    
    list [test::a 1] [test::a 2] $test::b
    
    The correct output is
    
    1 {New proc is called} 1
    
    and the output without the patch is
    
    1 2 2
    
    Explanation: 
    
      - at the first run of test::a [::set] is called as it was
    compiled into the proc  body. We cannot see the effects of a
    redefinition of a bcc'ed command from within the bytecode
    that did the redefinition, as it will run to the end once it
    starts executing.
    
      - at successive runs, the shadowed command is detected and
    a recompilation is forced: the new definition is used.
    
    
    
    
  4. login: "msofer"
  5. mimetype: "text/plain"
  6. username: "msofer"