Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: e25e31d13994c5ba564faa35b87d37b549c1bd15
Ticket: 7f02ff1efa308825b21e58ec04cee898fe9c44ad
unset traces on local vars write in caller context
User & Date: dgp on 2016-09-07 17:06:01
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/plain"
  4. comment changed to:
    proc constant {name value} {
        upvar 1 $name c  
        set c $value
        trace variable c wu [list reset $value]
    }
    proc reset {v a i o} {
        uplevel 1 [list constant $a $v]
     }
    proc demo {} {
      puts [info exists pi]
      constant pi 3.14
      puts [info exists pi]
    }
    puts [info exists pi]
    demo
    puts [info exists pi]
    
    Output is:
    
    0
    0
    1
    1
    
    Output should be:
    
    0
    0
    1
    0
    
    The unset trace that re-creates the variable
    is doing so in the caller context of [demo].
    This is wrong.
    
  5. is_private changed to: "0"
  6. login: "dgp"
  7. priority changed to: "5 Medium"
  8. resolution changed to: "None"
  9. severity changed to: "Minor"
  10. status changed to: "Open"
  11. submitter changed to: "dgp"
  12. subsystem changed to: "07. Variables"
  13. title changed to: "unset traces on local vars write in caller context"
  14. type changed to: "Bug"