beetlebug▾
/

namespace exists

Tells if a namespace exists.

namespace exists NS

Description

Gives 1 when the namespace NS exists, and 0 when it does not. A relative NS is read from the current namespace. :: and an empty string are the global namespace.

Arguments

ArgumentTypeDefaultDescription
NSnamespace namerequiredThe namespace.

Returns

1 or 0.

Examples

% namespace eval a {}
> namespace exists a
1

% namespace exists nope
0

% namespace exists ::
1

Errors

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

Facts

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

See also