Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: e03b9c7fdd31bfac9fbcfed64fd6c14f3483f212
Ticket: 1746143fffffffffffffffffffffffffffffffff
bug? Unset may not completely remove the variable
User & Date: msofer on 2007-07-01 19:17:56
Changes

  1. assignee changed to: "dgp"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    Notice that traces set during unset traces survive the [unset] - which is IMO more than what the man page promises with "Traces are not disabled during unset traces, so if an unset trace command creates a new trace and accesses the variable, the trace will be invoked". Bug or not? Should the variable always be completely gone after [unset]?
    
    Witness:
    
    % trace add variable x unset {trace add variable ::x unset {puts foo;#} ;#}
    % trace info variable x
    {unset {trace add variable ::x unset {puts foo;#} ;#}}
    % set x 1; unset x
    % trace info variable x
    {unset {puts foo;#}}
    
    Interesting effect: unsetting a var in a namespace does not guarantee that later upvars go to the global namesake.
    
    % set x 1
    1
    % namespace eval a {
    set ::a::x 2
    trace add variable x unset {trace add variable x unset {puts foo;#} ;#}
    unset x
    upvar 0 x y
    set y 3
    }
    3
    % set x
    1
    % set a::x
    3
    % unset a::y
    foo
    
    
  4. foundin changed to: "None"
  5. is_private changed to: "0"
  6. priority changed to: "5 Medium"
  7. resolution changed to: "None"
  8. status changed to: "Open"
  9. submitter changed to: "msofer"
  10. subsystem changed to: "07. Variables"
  11. title changed to: "bug? Unset may not completely remove the variable"
  12. type changed to: "Bug"