namespace upvar creates an alias to a namespace variable.
Resolves a variable named otherVar', which may contain namespace qualifiers, ' relative to namespace and gives it the name myVar'', which also my contain namespace qualifiers, in the current level. It is the same variable regardless of which name its value is read or stored through.
namespace upvar is a convenience command that doesn't add any functionality not previously available with upvar. The following are equivalent:
set ns ::foo upvar #0 ${ns}::bar boo
and
set ns ::foo namespace upvar $ns bar boo
However, the second form is more efficient as it requires less string manipulation and parsing.
In contrast to variable namespace upvar provides the ability to give the variable an arbitrary name :
proc myproc {} { variable var1 namespace upvar [namespace current] var1 myvar1 }
DKF: namespace upvar was created to help accelerate Snit.