beetlebug▾
/

namespace origin

Gives the full name of the command that an imported command calls.

namespace origin COMMAND

Description

Looks up COMMAND from the current namespace. When it is an imported command, it gives the full name of the command in the namespace it comes from, with each import of an import followed. For another command, it gives the full name of COMMAND.

Arguments

ArgumentTypeDefaultDescription
COMMANDcommand namerequiredThe command.

Returns

A full command name.

Examples

% namespace eval m {proc add {} {}; namespace export add}
> namespace eval imp {namespace import ::m::add}
> namespace eval imp {namespace origin add}
::m::add

# which gives the name of the import itself.
% namespace eval imp {namespace which add}
::imp::add

% namespace origin set
::set

Errors

% namespace origin nosuch
invalid command name "nosuch"
-errorcode NONE

% namespace origin
wrong # args: should be "namespace origin name"
-errorcode TCL WRONGARGS

Facts

Capability
None.
Tcl release
Tcl 9.1 and 8.6.
Since
ztcl 1.0.0-beta.1

See also