Tcl Heritage

Purpose: meditate on how other systems/languages shaped Tcl -- started by Richard Suchenwirth - please add what you think! Of related interest is the Tcl chronology.

TRAC Text Reckoning and Compiling

  • the original "everything is a string" language.

UNIX (borrowed from Multics [L1 ]):

  • "everything is a string" (at least command line arguments, argv)
  • the environment as a string->string mapping (::env array in Tcl)

Multics Command Language

  • cwd, pwd, and command execution [L2 ]
  • commands that start with the standard streams for standard_input, standard_output, and error_output[L3 ]
  • separation of commands by semicolon or newline
  • indication of optional parameters by name following a dash ("-"), e.g., [if ... -then ... -else ...]
  • Optional parameter names with both a long form and a short form, e.g., -home_dir or -hd
  • separation of parameters by whitespace
  • expansion of embedded commands [..] before calling the first command
  • # as comment marker
  • grouping of words with ".." and `..'
  • method of searching for unknown commands when encountered during processing (what's the exact concept here? Is it the implicit execification when running in the interactive shell? A more proximate source for that might be the Unix shells, or even Rexx. The concept is dynamic linking. When there is a command encountered that is not found, then the search rules are used to find a segment that defines the command so that it will be dynamically loaded. This dates from the mid 1960s, and I believe before the Unix shells.)
  • dynamically loading and linking commands
  • replacement of loaded procs with new ones while still running

UNIX shells (borrowed from Multics Command Language [L4 ] shell [L5 ]):

  • the names tclsh, wish (specifically the ;-)

Bourne family of shells (sh/ksh):

  • cd, pwd, exec
  • separation of commands by semicolon or newline
  • separation of parameters by whitespace
  • expansion of parameters before calling the command
  • expansion of embedded commands (`..` in shells, [..] in Tcl which nests better) before calling the first command
  • expansion of variables with $ ($x as shortcut for [set x]; not in earliest Tcl, but introduced by Karl Lehenbauer)
  • grouping of words with "..", which allows expansion
  • grouping of words without expansion (Unix shells use '..', Tcl has {..} which nests better--but see below)
  • # as comment marker
  • redirection of stdout and stdin

BSD's csh family of shells:

  • tilde expansion (~suchenwi or ~/bin..)
  • redirection of stderr
  • history command

UNIX tools:

  • expr (though Tcl's is much more powerful)
  • dash as switch marker (ls -l, glob -nocomplain)


  • incr (GfA Basic had that too, but assemblers were way earlier ;-)


  • regular expressions, [regexp], [regsub]. (But [switch -regexp] really feels like something from Snobol or Trac!)


  • associative arrays (Yes, I know, Snobol had them first, too!)


  • stdin, stdout, stderr
  • argv (argc unneccessary, we have [llength $argv])
  • for loop, while
  • fopen, fputs, fgets, fclose, ftell - minus the leading f
  • sprintf is format, especially the format string syntax
  • putting code blocks in braces (but much more generalized in Tcl)
  • expr syntax (infix operators, functions, parens..)


  • the name::space syntax (not exactly the most beautiful, tho)


  • parens as marker for array elements (but different functionality)
  • if statement (well, they had that earlier than C ;-)


  • lists as major data structure (though not implemented as chains of cons cells)
  • dynamic handling of list lengths
  • Polish notation, command is always first word
  • dynamic binding of commands, rename, replacing proc's at run time, code as data,[eval].
  • set returns value being set, I actually begged John to do this in the day. BTW, where did John get the idea of program glue? I first saw TCL at UseNIX after writing a small LISP library that was meant to let different programs pass data and command execution across pipes or network connections, that was program glue. things like fileevent are key to this.

[Incr Tcl]

  • Namespaces


  • [Sometime we need to ask JO about this.]
  • In the '80s, CDC's NOS/VE OS included System Command Language (SCL) [L6 ] which was embeddable and extensible. Applications and the OS could embed other applications (and the OS?) with pleasing symmetry and convenience.
  • [Was it Steve Lidie who observed this?]

X Window System:

  • the event model (as opposed to either multithreading or PL/I-style on-units) (see Tcl event loop) .
  • resource "database"

(not sure) (but all quite important to the character of the language; we need to ask John or Brent or Karl)

It strikes CL that grouping is crucial. Tcl's like Forth, Lisp, shell, and so on, but it elaborates "grouping" (what might be lexification in other languages) more than any other. C and TeX were two quite different predecessors that both use {} for a conceptual variety of grouping operations. m4 has `', rather clumsily.

Updates by: KBK (7 November 2000) - LV (Nov. 07/08, 2000) - CL (2001 ...) - escargo (Oct. 9-11, 2002)

See also Is Tcl different! - Arts and crafts of Tcl-Tk programming