REVIEW - Practical Programming in Tcl & Tk, Third Edition


Practical Programming in Tcl & Tk, Third Edition


Brent Welch



Prentice Hall (1999)




Joe McCool


April 2001



I can recommend this book and it justifies its third edition

Yes, I can recommend this book and it justifies its third edition. I am not an expert on Tcl/Tk and welcomed this text for that reason. Using the CD enclosed I was able to install the applications on my Linux box and Welch took me through the early stages of getting the language up and going. I can see that over the next year or two my copy is going to be well thumbed.

What are Tcl and Tk? Tcl is a scripting language, like so many others. But what sets it apart is the ability to add a Tcl interpreter to your applications. Tcl acts like glue between applications. 'Tcl fills the role of an extension language that is used to configure and customise applications.' Editors and terminal emulators have been written in Tcl. Tk is its graphical manifestation. Something the author appears to have missedis that Tcl/Tk seems to have found a new open source home on ActiveState (see

Amongst the code I did find the occasional error, but these were all flagged up on the author's web site ( He uses some very neat, though not original, tricks to fox the OS into executing long path names in running the shell (he uses extended comments to do this - fascinating) and this (page 17) to comment out large sections of code

if {0} {
unused code goes here

A trick like this could be used in many languages.

Welch covers Tcl right up to version 8.3. It is not a book of general interest and will appeal only to those closely involved (or about to be) in Tcl coding or to those who wish to dabble (in UNIX GUI prototyping for example).

Of particular interest to readers of these columns is his treatment of the Tcl in C programming. Here he explains that there are two basic approaches; 1. write extensions to add commands to the standard Tcl shell and 2. add the Tcl library to an existing application. The first one is the easiest. Chapter 44 treats both the original string based command interface and the version now available in 8.0, which is a more efficient dual-ported object interface. This is not for the lighthearted. All the examples are in pure C, not C++ and at times I was struggling to see the shape of an overall (main) example as distinct from numerous libraries.

This section on C programming is clear and well done. Welch points the reader to David Beasley's SWIG which generates C code to implement command procedures, exposing C and C++ APIs as Tcl commands.

The index is good and he makes reference to numerous web sites and news groups. Regular expressions, an essential part of any scripting language, are well treated.

Book cover image courtesy of Open Library.

Your Privacy

By clicking "Accept All Cookies" you agree ACCU can store cookies on your device and disclose information in accordance with our Privacy Policy and Cookie Policy.

By clicking "Share IP Address" you agree ACCU can forward your IP address to third-party sites to enhance the information presented on the site, and that these sites may store cookies on your device.