Version 4 of namespace which

Updated 2010-06-09 16:10:12 by LVwikignoming

namespace which ?-command? ?-variable? name

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.


2010-06-09 HaO

namespace which for array elements

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](Index)

which works but is IMHO nor beautiful, robust or optimizeable by the byte code compiler.

MS points to Bug #472113 [L1 ]

See also: