I still program often in Tcl, though. Lately, I've been looking at a lot of logs. While Cody Powell is prone to exaggerate a bit, it's not more than a bit: applications that end up in users' hands truly do benefit from "... thousands of hacked-up log lines for the most trivial operations ..." Logs are fascinating, 'cause they reflect real end-user behavior, and that has an inexhaustible capacity to surprise.
What does this have to do with Tcl? Tcl, Perl, Ruby, Python, Lua, and so on are all essentially the same language from an only slightly-elevated perspective: they're all succinct, procedural, more-or-less adequate at co-operation with other languages and systems, relatively light-weight, and quick to install. I already mentioned earlier that timestamping, in particular, is something that all languages need to and can do. Why reach for Tcl when Perl or Python have perhaps an order-of-magnitude more popularity?
Leaving aside domain-specific showcases like Expect, one of Tcl's gems is its time arithmetic. Long-time Tcl wizard Kevin Kenny rewrote the internals a few years ago, while preserving its backward compatibility; Tcl reliably calculates, "with accuracy in the tens of microseconds", such arcana as "what is the second Saturday after a particular timestamp?". Yesterday's date is this terse:
clock format [clock scan yesterday]].
clockknows the Japanese calendar, and even correctly handles Argentina's notoriously confusing timezones (which turn up in Powell's article, too, in no surprise to those who've spent quality time unraveling international error reports).
When I'm studying gigabytes of logfiles, I need small slices of "exploratory" programming to help confirm or reject hypotheses about what I'm seeing. These scripts are largely disposable. I could write them in almost any language, because essentially all modern languages have basic facilities for I/O, textual pattern-matching, arithmetic, and so on. I usually prefer Tcl, though, and its
clockis one of the reasons.
I'll return next week with code that shows another Tcl strength: concurrency.