title: How to effectively override a procedure-local variable in TCL
body: <p>So I have the following situation:</p>
  
  <pre><code>$ ls -l
  -r--r----- 1.tcl
  -rw-rw---- 2.tcl
  
  $ cat 1.tcl
  proc foo {args} {
    puts "$bar"
  }
  </code></pre>
  
  <p>and I need to make <code>1.tcl</code> print something other than <code>"can't read \"bar\""</code>. In a good programming language, the obvious solution would be</p>
  
  <pre><code>$ cat &gt; 2.tcl
  set -global bar "hello, world"
  foo
  </code></pre>
  
  <p>What would be a reasonable workaround in TCL? Unfortunately the real <code>foo</code> is a long function that I can't really make a copy of or <code>sed</code> to a temporary file at runtime.</p>