beetlebug▾
/

interp hide

Makes a command of an interpreter hidden from its scripts.

interp hide PATH CMD ?NAME?

Description

Removes CMD from the commands that the scripts of the interpreter of PATH can call, and keeps it as the hidden command NAME, or CMD with no NAME. Only interp invokehidden from an interpreter above it runs a hidden command, and interp expose makes it visible again.

Arguments

ArgumentTypeDefaultDescription
PATHinterpreter pathrequiredThe interpreter.
CMDcommand namerequiredThe command to hide.
NAMEstringnoneThe name of the hidden command, CMD by default.

Returns

An empty string.

Examples

% set c [interp create]; interp hide $c set; interp hidden $c
set

% catch {interp eval $c {set a 1}} m; set m
invalid command name "set"

% interp hide $c list hlist; lsort [interp hidden $c]
hlist set

Errors

% interp hide $c nope
unknown command "nope"
-errorcode NONE

% interp hide $c
wrong # args: should be "interp hide path cmdName ?hiddenCmdName?"
-errorcode TCL WRONGARGS

Facts

Capability
interp. A new interpreter does not have it until the host turns it on.
Tcl release
Tcl 9.1 and 8.6.
Since
ztcl 1.0.0-beta.1

See also