Looks up name as either a command or variable and returns its fully-qualified name. For example, if name does not exist in the current namespace but does exist in the global namespace, this command returns a fully-qualified name in the global namespace. If the command or variable does not exist, this command returns an empty string. If the variable has been created but not defined, such as with the variable command or through a trace on the variable, this command will return the fully-qualified name of the variable. If no flag is given, name is treated as a command name. See the section NAME RESOLUTION on namespace for an explanation of the rules regarding name resolution.namespace which for array elements
2010-06-09 HaO For me, it was surprising that
[namespace which -variable array(element)]
always returns the empty string, even if
info exists array(element)
returns true (e.g. the array element exists).
One might use for array elements:
[namespace which -variable array](element)
which works but is IMHO nor beautiful, robust or optimizeable by the byte code compiler.