interp
interp cmd ?arg ...?
Makes and runs child interpreters. A child has its own commands and variables, and never more capabilities than its parent. An alias is a command of a child that runs a command of the parent, and is the way to give a child one exact power.
Subcommands
| Synopsis | What it does |
|---|---|
interp create ?-safe? ?-meter NAME? ?--? ?PATH? |
A new child, and its path. -meter (capability meter) counts the child in a meter of ztcl::meter. |
interp eval PATH ARG ?ARG ...? |
Runs a script in the child. |
interp alias SRCPATH SRCCMD TARGETPATH TARGETCMD ?ARG ...? |
Makes SRCCMD of the child run TARGETCMD of the parent. |
interp aliases ?PATH? |
The aliases of a child. |
interp delete ?PATH ...? |
Removes children. |
interp exists PATH |
1 when the child exists. |
interp children ?PATH? |
The children. |
interp cancel ?-unwind? ?--? ?PATH? ?RESULT? |
Stops the script of the interp with the error "eval canceled", or RESULT. With -unwind, catch does not stop the error. |
interp slaves ?PATH? |
The old name of children. |
interp issafe ?PATH? |
1 for a safe interpreter. |
interp hide PATH CMD ?NAME? |
Hides a command from the scripts of the child. |
interp expose PATH NAME ?CMD? |
Makes a hidden command visible again. |
interp hidden ?PATH? |
The hidden commands. |
interp invokehidden PATH ?-global? NAME ?ARG ...? |
Runs a hidden command. |
interp marktrusted PATH |
Makes a safe child trusted. |
interp recursionlimit PATH ?N? |
The nesting limit of the child. |
interp target PATH ALIAS |
The target of an alias. |
Examples
set c [interp create]; interp eval $c {expr {6 * 7}}gives42interp alias $c double {} apply {{x} {expr {$x * 2}}}; interp eval $c {double 4}gives8
Facts
- Capability:
interp. A new interpreter does not have this command. See Limits and capabilities. - Compute cost: one compute unit for the call, and more for the commands that it runs.
Differences from Tcl 8.6
interp limitis not in ztcl. Each interpreter has the compute limit and the memory limit of the host instead.