Version 2 of pure-Tcl

Updated 2002-03-07 15:55:41

is a predicate for applications which consist only of Tcl code (no C extensions or packages).

PRO:

  • portable, will run on most or all platforms
  • easily edited even in deployed form

CON:

  • may run slower, especially in number-crunching
  • may expose implementation details that the end user is not supposed to know

In general, it is sensible to start coding an app in pure Tcl, and replace only those parts (if any) with C code that are just too slow. (But CPUs are picking up speed considerably faster than C coders ;-) (RS)


There are several subtleties and even polysemies to this term. Sometimes we say, "pure Tcl" in contrast to Tk; thus the 2.0 version of sockspy is useful for certain contexts because it can be run as "pure Tcl" without the requirement for a Tk interpreter.

Sometimes one uses "pure Tcl" to exclude not only extensions, but also exec. This partially invalidates the more general conclusion that pure Tcl implementations are more transparent; for example, in a pedagogic situation with Unix adepts, I might choose to write

    set content [exec cat $file]

rather than

    set fp [open $file]
    set content [read $fp]
    close $fp