Command variety

Tcl has a variety of types of commands that are possible to write. The following are all types of commands which are indistinguishable to their caller (that bit is important):

The interesting thing about this is that each of these command types can fully simulate the others. CMcC

Some of them are ensemble commands, we might say. Namespace ensembles, TclOO objects, interps in a sense contain other commands, or simulate their containment.

I look forward to the day when a builtin is being simulated by a coroutine, or a builtin is provided by a coroutine.

One could possibly stretch the analogy to include the reflected channel mechanism, since it is defined over a user-supplied container of commands.

The distinction between different kinds of command containers is probably the type of state they support, and the degree and kind of encapsulation they provide for state.

LV What are some examples of commands in each of the types? RS 2009-03-18 - see If we had no proc for how alias + apply can (almost?) fully substitute procs.