Tcl provides several commands which create commands and script evaluation contexts.
The purpose of this page is to enumerate and classify those commands.
generator | cmd? | #args | invocation | destructor | rename? |
---|---|---|---|---|---|
proc | yes | any | by name | yes | |
coroutine | yes | 1 | by name | yes | |
Tcl_CreateObjCommand | yes | any | by name | yes | |
namespace ensemble | yes | any | by name | namespace delete | yes |
class create | yes | any | by name | $class destroy | yes |
$class create | yes | any | by name | $obj destroy | yes |
interp alias | yes | any | by name | interp alias | yes |
interp create | yes | any | $interp eval | $interp destroy | yes |
thread::create | no | any | thread::send | thread::release | no |
apply | no | any | by reference | implicit | no |
key | |
---|---|
generator | what command generates an instance of this form? |
cmd? | does this form construct a command? |
#args | how many args does the constructed form take? |
invocation | how is this form invoked? |
destructor | what explicit destructor disposes of this form? |
rename? | does [rename $name {}] destroy this form? |
The generation of commands appears to be a means of invoking the form and of controlling the resources associated with the form.
There are two exceptions: In the case of apply, resources are associated with a value, and the lifetime of the generated form is tied to that of the value. In the case of thread, explicit refcounting is emplyed. In all other cases [rename $name {}] destroys both the command and its associated form.
interp-created commands duplicate functionality available through interp, to control interp resources. It would be more consistent with the other forms if $interp args were passed directly into the interp as if [interp eval]'d.
coroutine-created commands are the only forms restricted to single args.