namespace path
Gives or sets the namespaces where a command name is looked up after the current one.
namespace path ?LIST?
Description
Sets the path of the current namespace to LIST. A command name with no :: is looked up in the current namespace, then in each namespace of the path in order, and then in the global namespace. A relative name in LIST is read from the current namespace, and each namespace must exist.
With no LIST it gives the path, as full names. An empty LIST clears the path.
Arguments
| Argument | Type | Default | Description |
|---|---|---|---|
| LIST | list of namespace names | none | The new path. |
Returns
The path with no LIST, or an empty string.
Examples
% namespace eval lib {proc helper {} {return lib}}
> namespace eval app {namespace path ::lib; helper}
lib
% namespace eval app {namespace path}
::lib
% namespace eval app {namespace path {}; namespace path}
Errors
% namespace eval app {namespace path nope}
namespace "nope" not found in "::app"
-errorcode TCL LOOKUP NAMESPACE nope
% namespace path a b
wrong # args: should be "namespace path ?pathList?"
-errorcode TCL WRONGARGS
Facts
- Capability
- None.
- Tcl release
- Tcl 9.1 and 8.6.
- Since
- ztcl 1.0.0-beta.1