What is this Tcl/Tk stuff anyway?


Tcl is an interpreting language. Tk is a windowing toolkit for Tcl. The language is astonishingly portable, or ported: it runs on just about everything from the Mac to the Cray. Its native environment, however, is Unix, and that's where we use it. Tcl's great strength is that it's a very powerful scripting language and is easily integrated into (or around) existing applications.

Tcl is "in competition" with Perl, Bash, Ksh, and (somewhat) Python. In the PC environment, Tcl/Tk would certainly offer advantages over Visual Basic. Tcl doesn't seem (imho) to compete with Java, which is more like a competitor for C++. In fact, at Sun Tcl is being integrated with Java; Tcl (as the scripting language) and Java (as the system-level compiled language) is a good combination. It's odd, but Tcl might just be the best-kept secret in the computing world: although it's widely used in both academia and industry, and plenty of folks save lots of time and money by using it, somehow it doesn't get much coverage in the trade press. In fact, Tcl/Tk has sometimes been called "the best-kept secret of the software industry."


Q: How many Tcl programmers does it take to change a light bulb?
A: 500,000. But no one knows they're doing it.

What kinds of uses are people making of it? Well, some highlights: The main NBC newsroom is controlled by a realtime system held together with Tcl, with Tk GUI. Sybase owns a million-line test suite written in Tcl. Oracle uses Tcl in their Enterprise Manager product. Oil rigs in the Gulf of Mexico are controlled and monitored using Tcl. The Pathfinder mission used Tcl. ESO (European Southern Observatory) based its flagship image processing interface on Tcl. AltaVista uses Tcl. Check the Proceedings of the annual Usenix Tcl Conference, and you may be surprised at the variety of projects constructed with Tcl and Tk. There's even a Tcl plugin for Netscape.

Here at Lick Observatory, we use Tcl for building GUIs for large instruments (like the ESI Spectrograph), as well as for quality assurance testing, documentation and code generation, and a lot of other applications; see Tcl/2K Conference Poster for some other astronomy applications.


Why would you use Tcl? Well, it's easy to learn and read (as compared to, say, Perl). It's almost as easy to read as BASIC, yet it's far more powerful and easy to use than, say, Visual Basic. It's flexible and extensible (as compared to most other scripting languages). There's a very well-documented API for adding your own functions to the language, and a rich library of extensions already in existence. It's also truly interpreting, not semi-compiling like Python -- but release 8 will have a bytecode compiler, for improved portability and (where needed) code privacy.

At this site we mostly use Tcl/Tk for two reasons: first, Tk is the fastest environment in which we have ever developed X11 (GUI) applications; second, Tcl is a terrific language for list manipulation (without the high learning curve and weightiness of LISP) and since I focus largely on database applications and "information mechanics," a reliable and quick-to-write language for list processing is very valuable. Tcl is a killer language for database applications -- more details on that aspect in the Guided Tour.

Tcl/Tk is also FREE (given our budgetary situation, this is an important virtue!) and Open Source. The core is supported by Scriptics, and you can get professional support and consulting from them and from other companies; but an enthusiastic international community of hackers supports a large library of extensions to the language. We have little fear, therefore, that it will be "orphaned" as some more obscure languages have in the past. The Tcl/Tk developer community is one of the exemplary Internet communities: friendly, generous, and devilishly ingenious. Check out comp.lang.tcl!


If you take a look at some of the apps we have developed using Tcl/Tk, and some of the apps other people have written which we use here daily, you'll probably see why we think it's a great language. The Guided Tour will take you through our little Tcl world, and provide references to some other folks' terrific Tcl/Tk applications as well.

For more (and much more official) information about Tcl, see
The Scriptics Home Page (for news about the core Tcl distribution),
The Tcl/Tk Home Site (the online manpages are especially good!),
and/or The NeoSoft Tcl Page (for the lowdown on Tcl contributors and free extensions).