'''`[namespace] upvar`''' creates an alias to a namespace variable. ** Synopsis ** : '''namespace upvar''' ''namespace otherVar myVar'' ?''otherVar myVar ...''? ** Description ** Resolves a variable named ''otherVar'', which may contain [namespace%|%namespace qualifiers], relative to ''namespace'' and makes ''myVar'', which also may contain [namespace qualifiers], an alias in the current [level] for that variable. 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]. ** See Also ** [namespace]: the primary command for working with namespaces <> Command | Tcl syntax help