Runtime creation of procs

During March 2003, Glenn Jackman, Don Porter, Donald Arseneau, Arjen Markus and possibly others were discussing procs creating procs during runtime.

One of the issues discussed was that of scope - if a proc creates a proc, without anything fancy being done, in what namespace is the runtime created proc?

Here's an example provided by Ulrich Schoebel:

 % proc foo {} {proc bar {} {puts baz_1}}
 % namespace eval mymy {proc foo {} {proc bar {} {puts baz_2}}}
 % foo
 % ::mymy::foo
 % bar
 baz_1
 % ::mymy::bar
 baz_2
 %

which appears to demonstrate dgp's assertion that procs with non-fully-qualified names are created in the current namespace, whatever that happens to be.


I created some functions to generate a tagged list for the body of a proc. Check out manipulating a proc with tags. - xonecubed -