Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 232b172a4b5bf7826251b85aeb40752e7471a2a1
Ticket: 9ca25bce1341913e910f612f13a64ac9cfea2598
There is no notion of local procedure inside a procedure
User & Date: anonymous on 2015-04-18 05:11:43
Changes

  1. icomment:
    My new approach is this:
        Each variable or procedure created in the ::local namespace is automatically deleted when a function returns.
    
    Inspired by this code:
        http://wiki.tcl.tk/997
    
    
     proc local_procs {} {
        namespace eval ::local {}
    
        uplevel 1 { 
            set __[lindex [info level 0] 0]  {}
            trace variable __[lindex [info level 0] 0] u {namespace delete ::local;}
    
        }
     }
    
    
    With this new approach, I have to write local_procs at the begining of each proc. But it would be nice if this happens automatically by the interpreter.
    
  2. login: "anonymous"
  3. mimetype: "text/plain"