Version 0 of Is Tcl Different!

Updated 1999-08-17 11:35:16

Purpose: enumerate what makes The cool language special -- Richard Suchenwirth


Simplicity
The man page Tcl(n) teaches you, in 11 rules and 264 lines, just about everything about the syntax: basically it's about semicolon, newline, whitespace, braces, brackets, dollarsign, pound/hash (*). Of course there are "words", but all on the same level as the procs you write. List elements are joined with whitespace, this allows for beautiful human-readable coding with little effort (see Salt and Sugar). Bidirectional pipes are available with just
     set p [open |foo r+]
Unity of data and code
after all, just about everything is still a string. If you know (or want to find out) what you're doing, just eval it.
Introspection capabilities
see what vars, commands, procs, widgets, ... you have available; for a proc, dump its args and body; ..., let widgets say their configuration... "Supraspection": Look above you in the call stack with upvar and uplevel
Shimmering
surf between string, list, integer representations with no explicit conversions. This may at times cost performance, but at other times allows beautiful simple code, e.g. add a list of numbers with
     expr [join $list +]
Internationalization
Unicode (see Unicode and UTF-8), and thus just about every widely-used writing system in the world, is allowed in all strings. How much needed and how fully implemented this is, is sometimes debated. The read and source commands can't handle Unicode files opaquely yet. But with all its flaws, Tcl offers the best i18n environment I've seen so far. Tk's mechanism of finding a Unicode char in other fonts is extremely helpful when you go global
User-friendliness
Even most Tcl error messages are kind of a joy to read - endless loops (recursions) aren't endless anymore but detected and reported. Most commands are implemented in a pretty common-sense, evident way. Quite a number of Tcl friends read, and often answer questions, in news:comp.lang.tcl
Openness
you can do much more with this extremely flexible language than you'd expect, by combining string manipulation, eval, and sometimes the unique 'unknown' command (see Radical Language Modification). Consider Stephen Uhler's HTML parser in 10 lines. You can write Tcl procs that are called in SQL syntax (but never the other way round ;-)
Tk is the best, easiest GUI scripting toolset around.
Proof is that the Perl and Python colleagues also use it, even if they have to emit some Tcl code for that. But the freshest Tk is always bundled with Tcl.

* Couldn't write this up there :-)

 ;\n\s{}[]$"#

For fun and serious code goodies, see Bag of Algorithms or Bag of Tk algorithms!