10 Things I Hate About Tcl

I really, really, really don’t like Tcl. Here are some of the reasons why.

1. The syntax for basic language elements is broken and inconsistent. Look, go ahead and put dollar signs in front of variables. Or don’t put dollar signs in front of variables. I don’t really care. But make up your mind; don’t make me have to figure out which syntax I need to use from context.

2. No syntax checking until the program actually executes a given line of code. Look, guys, maybe this made sense twenty years ago when you were running on a DECstation 2100, but those few extra milliseconds really aren’t going to kill us. Conversely, the interpreter is forced to reparse all syntactic blocks (for loops, if statements, and so on), every single time they are executed. So you spend cycles reparsing the syntactic blocks that actually execute at runtime, yet I still have no confidence that the syntax of every line in my script is correct, unless I use some external tool like procheck. Way to go, boys! Welcome to 1986!

3. The backtraces. Oh my god, the backtraces. Python has backtraces, and yet somehow they’re useful. No one has ever, in the entire history of Tcl, fixed a bug based on its unreadable and baroque backtraces.

4. A special case of item 3: if you’re taking the trouble to tell me what line offset in a given function the bug you encountered was, maybe you could spend another thirty bytes or so and mention, casually, what file the error was in? No, that would make too much goddamn sense.

5. Idiomatically, the existence of exceptions in the language is used to excuse lousy programming. Here’s how every Tcl program in the world that has ever been written since the beginning of time handles exceptions:

try { set somevar [10000_lines_of_code [1000_lines {$arg}]] } catch { error “Something went wrong!” }

6. Tcl wants to use { and } in places where God intended us to use ( and ).

7. The “expr” construct is hateful. Which of these makes more sense? value = value ^ 2 or set value [expr $value ^ 2]"?

8. You have to explicitly invoke expr, except it’s automatic in if and while conditions, which is pretty much the one place where you don’t want it.

9. No real data structures to speak of. Everything is a string.

10. Tcl doesn’t actually have scoping “rules.” Really, they’re more like scoping “polite suggestions.” You can examine and change (!) variables in your caller’s stack frame (upvar). You can execute blocks of code in your caller’s context (uplevel). You can tear your own face off with your toenails and devour it, ending your life as a slavering, pathetic beast, whimpering in a pool of your own blood.

In summary: I really, really, really don’t like Tcl. Thank you, and good night.