beetlebug▾
/

namespace inscope

Runs a script in a namespace with more words; the form that namespace code makes.

namespace inscope NS SCRIPT ?ARG ...?

Description

Runs SCRIPT in the namespace NS with each ARG as one more word of its command, kept as list elements. NS must exist. namespace code makes this form, and code seldom calls it by hand.

Arguments

ArgumentTypeDefaultDescription
NSnamespace namerequiredThe namespace, which must exist.
SCRIPTscriptrequiredThe script.
ARGstringnoneA word to put after SCRIPT.

Returns

The result of the script.

Examples

% namespace eval cb {variable n 2}
> namespace inscope ::cb {set n}
2

% namespace inscope ::cb {list a} {b c} d
a {b c} d

Errors

% namespace inscope nope {set x}
namespace "nope" not found in "::"
-errorcode NONE

% namespace inscope
wrong # args: should be "namespace inscope name arg ?arg...?"
-errorcode TCL WRONGARGS

Facts

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

See also