beetlebug▾
/

namespace forget

Removes imported commands.

namespace forget ?PATTERN ...?

Description

Each PATTERN is a name with a namespace, as for namespace import. It removes each command of the current namespace that was imported from that namespace and matches the pattern. The command of the other namespace stays. A command that is not imported stays. A namespace that does not exist is an error.

Arguments

ArgumentTypeDefaultDescription
PATTERNqualified glob patternnoneThe namespace and the names of the imported commands to remove.

Returns

An empty string.

Examples

% namespace eval m {proc add {a b} {expr {$a + $b}}; namespace export add}
> namespace eval app {namespace import ::m::add; namespace forget ::m::add; info commands add}

% info commands ::m::add
::m::add

% namespace forget

Errors

% namespace forget nope::x
unknown namespace in namespace forget pattern "nope::x"
-errorcode TCL LOOKUP NAMESPACE

Facts

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

See also