namespace upvar creates an alias to a namespace variable.
Resolves a variable named otherVar', which may contain namespace qualifiers, relative to namespace and makes myVar, which also my contain namespace qualifiers, an alias in the current level for otherVar''.
It is an error for otherVar and myVar to resolve to the same variable unless that variable is already a name for some other variable. This makes it possible to determine whether a variable is an alias.
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.