Tcl the Misunderstood

Tcl the Misunderstood is an old article, but I haven't seen it discussed here before:

I am not going to show you every single Tcl feature, but I want to give an idea of advanced programming tasks that are solved in a very nice way with Tcl. I want to stress that I think Tcl has a number of faults, but most of them are not in the main ideas of the language itself. I think there is room for a Tcl-derived language that can compete with Ruby, Lisp and Python today in interesting domains like web programming, network programming, GUI development, DSL and as scripting language.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Theory of Language Affinity

Back when APL was still considered interesting, I formed the opinion that advocacy for a PL is directly proportional to the arcanity and sheer massochism required to program in that language. As two extremes, people brag loudly about the wonders of programming in APL or LISP, but tend to shuffle off quietly (and looking embarassed) when forced to admit that they know BASIC or JavaScript.

I have yet to observe a quiet advocate for TCL, and as with other forms of massochism, it feels so good when you stop...

Whose misunderstanding

I'd say that whenever somebody claims that "the programmer doesn't need to think about types" -- especially in boldface -- you can safely stop reading. The misunderstanding is rather gonna be on his side.

Lexical scoping

Once, for work, I had to modify a Tcl program. Having no prior Tcl experience, I found it interesting how everything was either a string or a list, and how simple the evaluation rules were. And then I found out that my closures didn't capture the lexical scope. That pretty much ruined it for me.

I'm not sure that it isn't possible to have lexically scoped closures in Tcl (my recent attempt to find out was inconclusive), but it definitely wasn't the default and definitely wasn't covered in the online examples I used to learn Tcl.

The Great Tcl Debate of 1994

Re: lexical scoping:

And then I found out that my closures didn't capture the lexical scope. That pretty much ruined it for me.

I take it you find both Forth and Prolog unworthy for the same reason? Have you looked at upvar or uplevel? The mere fact that Guido finds them appalling means that they can't be all that bad, can they? They work very well in the context for which Tcl was originally designed.

Which reminds me... Although John Ousterhout's seminal paper3 has been mentioned in passing4-9, it was never discussed on LtU as far as I can tell. A damn shame.

Anyhow. If you have a couple of hours to spare, you should go read The Tcl War. If you have a couple of days, you can read the entire thread.1

On second thought, given that the original post by RMS was cross-posted to gnu.announce, gnu.utils.bug, gnu.misc.discuss, comp.lang.tcl, comp.lang.scheme, comp.windows.x.apps, comp.unix.misc, you're unlikely to find all of the follow-ups in this highly entertaining debate. RMS did not participate in any of the ensuing carnage but tried to "make amends" two years later.2

Footnotes

  1. Why you should not use Tcl by Richard M. Stallman, Sep 24, 1994, Message-Id: <9409232314.AA29957@mole.gnu.ai.mit.edu>.
  2. "Why you should not use Tcl" by "Richard M. Stallman"10, Apr 24, 1996.
  3. Scripting: Higher-Level Programming for the 21st Century by John K. Ousterhout, IEEE Computer, March 1998, pp. 23-30. (A must read.)
  4. 13 most cited PL articles, Sep 2004.
  5. Two Languages (high+low level) vs One Language, LtU, Oct 2004.
  6. Have scripting languages peaked?, LtU, Aug 2005.
  7. The A-Z of Programming Languages, LtU, Jun 2006.
  8. Purpose-Built Languages, LtU, May 2009.
  9. on multiple fronts in 1994, LtU, Jan 2010.
  10. Edited in response to comment-58302.

Haha

RMS did not participate in any of the ensuing carnage but tried to "make amends" two years later.

Did he? Read the last few lines of that post, and the ensuing discussion. It's not so clear who tried to make amends, AFAICS. I think there's someone here on LtU who might be able to shed a little light, though... ;)

The dark inside story of the Tcl Wars

It came out rather long so I stuck it on my own website rather than post it here:

The Infamous Tcl War

which begins:

On the blog Lambda the Ultimate Matt Hellige prompted me to explain a certain mystery surrounding the infamous "Tcl War" between the GNU project and Sun Microsystems. He noticed that some of the key "netnews" posts from Richard Stallman in the "War" had his name in the "From:" line, but my name in the signature. Here, I'll oblige by telling a story. Well, part of the story. I'm going to withhold some details because I'm just that kind of guy. In this story some innocents may have been named in order to protect the changed. Or something like that.

There are some mysteries I think are likely to remain permanent about the so-called Tcl war. "From:" lines, and signatures on certain famous messages are not necessarily a reliable guide to who wrote or posted what. It's a bit hard to describe how exactly whose names wound up where on what and probably best to not try. I'll just say that there was some half-friendly / half-hostile pranking involved.

I can offer some history, though - at least as well as I recall it 16 years later. The story I tell here is a bit long winded but includes some history about Java, Tcl, Javascript, and Guile.

Thanks

Finally got around to reading this. Thanks for posting it. It's always very interesting to me to hear the inside view on events that occurred at a rather formative time for me, even though I was (a) much younger, (b) two thousand miles away and (c) decidedly an outsider looking in (well, I'm still that — I'm still two thousand miles away, too, now that I think about it).

And then I found out that

And then I found out that my closures didn't capture the lexical scope. That pretty much ruined it for me.

I take it you find both Forth and Prolog unworthy for the same reason? Have you looked at upvar or uplevel? The mere fact that Guido finds them appalling means that they can't be all that bad, can they? They work very well in the context for which Tcl was originally designed.

I haven't used Forth ever. I've only used Prolog a bit, but never used higher-order functions or closures.

That one time I did have to deal with Tcl, the issue of not capturing the lexical environment came up when I reorganized the code to try and remove duplication ("Hey, Tcl has closures! This code can be way shorter!"). I did try searching for a fix, but I guess I was less familiar with the terminology back then. I wish I had stumbled across "upvar" back then so I wouldn't have had to undo my improvements.

I don't mean to bash the creators of Tcl or disregard the historical context. I'm just saying that, in a language whose standard library seemed to promote higher-order programming quite a bit, I was surprised that such simple cases didn't work "properly". And that's what ruined it for me.

TCL

TCL is still much used as a "Tool Command Language" : Embedded in larger applications, it behaves like an UNIX shell. Maybe LUA is TCL's natural successor.

Its syntax is suitable for typing command lines with a minimal number of characters, things as mundane as :

run 100ms

TCL is a stealth language. Similarly, facing the shell prompt, most users does not care about the fact that they are interacting with a programmable language interpreter.