beetlebug▾
/

namespace parent

Gives the namespace that has a namespace in it.

namespace parent ?NS?

Description

Gives the full name of the namespace around NS, the current namespace by default. The global namespace has no parent: its parent is an empty string. A NS that does not exist is an error.

Arguments

ArgumentTypeDefaultDescription
NSnamespace namethe current namespaceThe namespace.

Returns

A full namespace name, or an empty string for ::.

Examples

% namespace eval a::b::c {}
> namespace parent ::a::b::c
::a::b

% namespace parent a
::

% namespace parent

% namespace eval a::b {namespace parent}
::a

Errors

% namespace parent nope
namespace "nope" not found in "::"
-errorcode NONE

% namespace parent a b
wrong # args: should be "namespace parent ?name?"
-errorcode TCL WRONGARGS

Facts

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

See also