What does it mean for a language to be called “Tcl”? It surely cannot just mean that it is built from C via libtcl; there must be something deeper than that. Well, the Endecalogue/Dodekalogue must have something to do with it of course, but is that all? I suspect not; you can't do anything without more than that. So on this page, I'm going to try to identify what additional things have to be there to make up something that we'd recognize as Tcl. In particular, I'm going to identify “profiles” that comprise a particular language core, related semantics and minimal associated set of commands; these profiles will build on top of each other of course.
This profile approximates the language that was there in Tcl 7.*
- Rule set
- All values are strings of characters drawn from an unspecified (but assumed 8-bit extension to ASCII) character set. There is an undifferentiated space of (global) commands, indexed by name, and a second undifferentiated space of global variables.
- set, expr, source, if, while, for, foreach, append, lappend, lindex with a single index, llength, list, eval, proc, global, upvar, uplevel, return (but not -options), break, continue, error, info (but only info exists of the subcommands is necessary), string (minimal list of subcommands: string compare, string first, string last, string range, string match), puts, rename
- Recommended extensions
- incr, concat, linsert, lrange, lreplace, lsearch (no options mandatory), lsort (no options mandatory), regexp and regsub (RE language not specified), format, scan, split, join, trace (only needed on global variables), switch (only required option is --; exact matching must be supported by default), subst
This profile is 7 plus array variables and the array command (particularly, array get, array names, array set). If trace is supported, traces must be allowed on whole arrays or individual entries.
Everything in 7a, but also with after, open, close, gets, read, fconfigure, fileevent, eof, fblocked, bgerror, update and vwait. (i.e., the event and core IO system). Also supporting socket is recommended, but not required. Note that it is up to implementations to define the meaning of "filenames" used by open. Also recommended is clock (especially clock seconds, but clock format and clock scan are also of reasonable priority).
This profile adds the following to 7:
- All values are Tcl_Obj (or equivalent); conceptually read-only, but implementations may optimize. Characters are drawn from UNICODE character set (TODO: Specify which version). Commands and variables exist in a hierarchical collection of namespaces; :: is the separator and the name of the root namespace.
- namespace, variable, package require, encoding (only encoding convertto and encoding convertfrom are mandatory), binary (only binary format and binary scan)
Profiles: 8a, 8+
These are the combined children of 8 and 7a/7+ respectively. 8+ adds fcopy to the list of commands.
As 8, but with also lset, lindex with multiple indices. Support for interp is recommended (especially interp alias where source and target arguments are the empty string).
Profiles: 8.4a, 8.4+
As 8.4, but with these changes:
- Rule set
- Mandatory Commands
- apply, dict (especially dict get, dict set, dict exists), lassign
- Recommended Commands
- lrepeat, lreverse
Adds chan to list of commands over 8.5/8.4+ combination
- try, throw
TODO: work this out, but likely the coroutine/tailcall stuff plus TclOO