beetlebug▾
/

namespace children

Gives the namespaces in a namespace.

namespace children ?NS? ?PATTERN?

Description

Gives the full name of each namespace in NS, the current namespace by default. Only the namespaces one level down are in the list. With PATTERN, the list has only the names that match it as a glob pattern. A PATTERN with no :: at the start matches against the names in NS: a* in :: is ::a*.

A NS that does not exist gives an empty list.

Arguments

ArgumentTypeDefaultDescription
NSnamespace namethe current namespaceThe namespace to list.
PATTERNglob patternnoneThe names to keep.

Returns

A list of full namespace names.

Examples

% namespace eval a::b {}
> namespace children ::a
::a::b

% namespace children :: a*
::a

% namespace children ::a::b

% namespace children nope

Errors

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

Facts

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

See also