After 27 years, Tcl/Tk 9 finally arrives with 64-bit power and Zip file magic

Now that's the kind of stability we like

Tcl/Tk 9.0 has moved to Unicode and 64-bit data structures, and can now access compressed files as if they were file systems. It has been worth the considerable wait.

The Tcl/Tk team doesn't rush into new versions. The previous major release, version 8.0, was in 1997, and the last minor release, version 8.6, came out in 2012. Now version 9.0 introduces some significant additions, including 64-bit support – and some breaking changes.

Tcl/Tk – which stands for "Tool Command Language" and "ToolKit," pronounced "tickle-teak" – is a tiny programming language with its own integrated toolkit for writing GUIs. Tcl was first released way back in 1988, before Linux, FreeBSD, NetBSD, or even Windows 3.0.

Over a nearly four-decade timeline, it has grown – but not by anywhere near as much as many comparable projects. It started out considerably smaller than, for instance, another scripting language often described as small and simple, Lua, which didn't appear until six years later.

Tcl/Tk 9 remains relatively small and simple today. What's changed is that it can now take on much bigger, and indeed richer, chunks of data. It is now internally 64-bit, so as the release notes say:

  • Strings can be any length (that fits in your available memory).
  • Lists and dictionaries can have very large numbers of elements.

(The release notes for Tcl 9 and Tk 9 are two separate Markdown files, which complicates linking directly to them – but you can download both from the project's SourceForge page. Yes, SourceForge: Tcl was nearly old enough to vote when Git first appeared, so only a mirror of the source code is on GitHub. SourceForge is better behaved than it once was, and along with Slashdot is now part of BizX.)

Tcl 9 also natively supports Unicode and can directly access Zip files (as well as several other archive formats, such as .jar and .tar files), meaning that you can open the compressed file directly and navigate its contents as if they were a normal file system.

Although it is not an especially fast language, version 9 supports both the Linux epoll() and BSD-style kqueue() event-notification APIs to help write more responsive code.

Tk 9 has been modernized too. It is scaling-aware, for HiDPI displays, supports two-finger mouse gestures, can access the OS's notifications, system tray, and printing subsystems, access photo metadata, and has partial support for the XML-based SVG image format. It also has a wide range of themes, some of which can be seen in this screenshot gallery – although we note that it hasn't been updated for Tk 9 yet.

For some, Tcl's appeal is its simplicity. Its core principles are outlined in just 12 rules, which the project calls the Dodekalogue. Colin Macleod's article, "Why I'm Tcl-ish," calls it "clean, logical, and consistent," and compares it favorably to Lisp. We also rather liked Will Duquette's description:

The Tcl language is made up of commands; a command has a name and takes an argument list, with which it can do literally anything. The standard commands are written in C; Tcl procs are commands that are written in Tcl. The control structures, like if and foreach and while is just a Tcl command. The proc command that defines a proc is just a Tcl command.

I think of it as Lisp for C programmers.

In fact, several commenters in the Hacker News thread about the new release compared it to Lisp:

Such an elegant language: simple, easy to learn, flexible. I call it Lisp for humans.

Or…

It possesses the elegance of Lisp while maintaining practicality.

And earlier:

Tcl is like a Lisp where space-separated strings take the place of S-expressions.

Even if Lisp has some weighty admirers, comparisons to it may put off as many people as they encourage. So perhaps some other plaudits might help.

Another famously small and simple tool, SQLite, which as The Register said in 2020 "claims to be 'used more than all other database engines combined,'" emerged from the Tcl project:

The SQLite library is designed to be very easy to use from a Tcl or Tcl/Tk script. SQLite began as a Tcl extension and the primary test suite for SQLite is written in Tcl. SQLite can be used with any programming language, but its connections to Tcl run deep.

Redis has gained considerable attention recently. Its original author, Salvatore Sanfilippo, admires Tcl, as his essay "Tcl the Misunderstood" spells out. It's subtitled "Why Tcl is not a toy language, but a very powerful one."

Tcl/Tk 9 is a substantial change, and not all programs will come across unmodified. As the announcement says:

Many Tcl programs written for Tcl 8 will run unchanged in Tcl 9. Many more Tcl programs can be modified in small and simple ways to produce a new program that runs in both Tcl 8 and Tcl 9.

If this proves too hard, the release notes hint:

The experiences of Tcl/Tk 8 users adapting their code to Tcl/Tk 9 will determine the need for possible Tcl 8.7 releases that might supply additional life cycle and migration support. ®

More about

TIP US OFF

Send us news


Other stories you might like