Version 2 of Tcl Heritage

Updated 2001-10-12 15:20:43

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.


UNIX (or a predecessor?):

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

UNIX shells:

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

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)
  • # 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)

Assembler:

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

Awk/Lex/Egrep:

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

Awk:

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

C:

  • 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..)

C++:

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

FORTRAN:

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

LISP:

  • 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].

[Incr Tcl]

  • Namespaces

X Window System:

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

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


Updates by: KBK (7 November 2000) - LV (Nov. 07/08, 2000) - CL (2001 ...)


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