Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: e2d2d51362b0bad8f102c87d6334f9d78153ec28f33ec60e39452aefdcee51d0
Ticket: 7cea8bfad06c3f18421511d24e25cfa8a7d1fd87
[dict for] "value" var name escapes code block scope
User & Date: sethrader on 2024-03-17 17:31:11
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/x-markdown"
  4. comment changed to:
    Running the following code will produce an error on attempting to declare a variable "h":
    
    ```
    #!/usr/bin/env tclsh                                                                
                                                                                        
    proc p {} {                                                                         
        variable d {a 0}                                                                
                                                                                        
        dict for {key h} $d {}                                                          
                                                                                        
        variable h "Should not be set already"                                          
    }                                                                                   
                                                                                        
    p 
    ```
    
    Note: this only seems to occur in the body of a procedure.  The code inside proc "p" will execute fine if executed outside a procedure body.
    
    Platform: Linux/Tcl 8.6.14
    
    Could not replicate the same issue on Tcl 8.6.13 under Wine
    
  5. foundin changed to: "8.6.14"
  6. is_private changed to: "0"
  7. login: "sethrader"
  8. priority changed to: "5 Medium"
  9. private_contact changed to: "0ae952f0c697d54d4d2c5ee3f3c3968bce95854e"
  10. resolution changed to: "None"
  11. severity changed to: "Critical"
  12. status changed to: "Open"
  13. submitter changed to: "sethrader"
  14. subsystem changed to: "15. Dict Object"
  15. title changed to:
    [dict for] does not clean up "value" var name after execution
    
  16. type changed to: "Bug"