Tcl (pronounced as an acronym, , like tickle, or as an initialism, , like T-C-L; originally Tool Command Language) is a high-level, general-purpose, interpreted, dynamic programming language. It was designed with the goal of being very simple but powerful. Tcl casts everything into the mold of a command, even programming constructs like variable assignment and procedure definition. Tcl supports multiple programming paradigms, including object-oriented, imperative, functional, and procedural styles. It is commonly embedded into C applications for rapid prototyping, scripted applications, GUIs, and testing. Tcl interpreters are available for many operating systems, allowing Tcl code to run on a wide variety of systems. Because Tcl is a very compact language, it is used on embedded systems platforms, both in its full form and in several other small-footprint versions. The popular combination of Tcl with the Tk extension is referred to as Tcl/Tk (pronounced "tickle teak" or "tickle TK") and enables building a graphical user interface (GUI) natively in Tcl. Tcl/Tk is included in the standard Python installation in the form of Tkinter.
History The Tcl programming language was created in the spring of 1988 by John Ousterhout while he was working at the University of California, Berkeley. Originally "born out of frustration", according to the author, with programmers devising their own languages for extending electronic design automation (EDA) software and, more specifically, the VLSI design tool Magic, which was a professional focus for Ousterhout at the time. Later Tcl gained acceptance on its own. Ousterhout was awarded the ACM Software System Award in 1997 for Tcl/Tk. The name originally comes from "Tool Command Language", but is conventionally written Tcl rather than TCL.
Tcl conferences and workshops are held in both the United States and Europe. Several corporations, including FlightAware use Tcl as part of their products.
Features
Tcl's features include
All operations are commands, including language structures. They are written in prefix notation. Commands commonly accept a variable number of arguments (are variadic). Everything can be dynamically redefined and overridden. Actually, there are no keywords, so even control structures can be added or changed, although this is not advisable. All data types can be manipulated as strings, including source code. Internally, variables have types like integer and double, but converting is purely automatic. Variables are not declared, but assigned to. Use of a non-defined variable results in an error. Fully dynamic, class-based object system, TclOO, including advanced features such as meta-classes, filters, and mixins. Event-driven interface to sockets and files. Time-based and user-defined events are also possible. Variable visibility restricted to lexical (static) scope by default, but uplevel and upvar allowing procs to interact with the enclosing functions' scopes. All commands defined by Tcl itself generate error messages on incorrect usage. Extensibility, via C, C++, Java, Python, and Tcl. Interpreted language using bytecode Full Unicode (3.1 in the beginning, regularly updated) support, first released 1999. Regular expressions Cross-platform: Windows API; Unix, Linux, Macintosh etc. Close, cross-platform integration with windowing (GUI) interface Tk. Multiple distribution mechanisms exist: Full development version (for Windows e.g. ActiveTcl, see [1]) Tclkits (single file executable containing a complete scripting runtime, only about 4 megabytes in size), Starkits (wrapping mechanism for delivering an application in a self-contained, installation-free, and highly portable way) and Starpacks (combine Starkit with Tclkit to produce a Starpack – a single platform specific executable file, ideal for easy deployment) The Jim Interpreter, a small footprint Tcl implementation Freely distributable source code under a BSD license.
Safe-Tcl Safe-Tcl is a subset of Tcl that has restricted features so that Tcl scripts cannot harm their hosting machine or application. File system access is limited and arbitrary system commands are prevented from execution. It uses a dual interpreter model with the untrusted interpreter running code in an untrusted script. It was designed by Nathaniel Borenstein and Marshall Rose to include active messages in e-mail. Safe-Tcl can be included in e-mail when the application/safe-tcl and multipart/enabled-mail are supported. The functionality of Safe-Tcl has since been incorporated as part of the standard Tcl/Tk releases.
Syntax and fundamental semantics The syntax and semantics of Tcl are covered by twelve rules known as the Dodekalogue. A Tcl script consists of a series of command invocations. A command invocation is a list of words separated by whitespace and terminated by a newline or semicolon. The first word is the name of a command, which may be built into the language, found in an available library, or defined in the script itself. The subsequent words serve as arguments to the command:
commandName argument1 argument2 ... argumentN
The following example uses the puts (short for "put string") command to display a string of text on the host console:
This sends the string "Hello, World!" to the standard output device along with an appended newline character. Variables and the results of other commands can be substituted into strings, such as in this example which uses the set and expr commands to store the result of a calculation in a variable (note that Tcl does not use = as an assignment operator), and then uses puts to print the result together with some explanatory text:
The # character introduces a comment. Comments can appear anywhere the interpreter is expecting a command name.
… excerpt ends here. Continue reading the full article.


