Lars Pind

internet software, coaching, and entrepreneurship

Lars Pind - internet software, coaching, and entrepreneurship
Check out Coach TV, my video blog on happiness and personal development for geeks.

Breaking news: Tcl considered lacking in some areas

January 19, 2005 · See comments

As I am doing programming in Tcl and Ruby side by side, I am noticing some important (if obvious) differences.

One of them is how, with Ruby (or any OO language), you can easily do lazy computation, simply using methods on objects. Nothing earth-shattering here (move along, please), but since Tcl does not have objects I find myself passing around arrays as a poor-man’s version of objects. But that requires that I calculate all values up-front, instead of only as needed. An obvious performance loss, not to mention a nuisance because you have to worry more about any overhead you are adding.

(There are ways around this, such as having attributes actually be procedure calls, so you say [$item(url)] instead of $item(url), but that has other drawbacks, including not working naturally with the templating system I am using.)

Also, now that I have gotten used to developing in Ruby, I keep bumping into instances where Ruby has simple constructs that saves me several lines of code. A classic example, that I cannot believe Tcl does not have: Array#collect. When you want to process each element of a list (such as adding quotes around them before using them in an IN clause in a SQL statement), you have to write 5 lines of code for what in Ruby is just types.collect { |e| ”’#{e}’” }.join(”, “).

There are many more and far deeper differences going on, but these are the ones I happened to be experiencing tonight, as I am sitting here ate De Balie, developing this CMS for Greenpeace.

blog comments powered by Disqus

Comments ↓

  • 1 Mark Aufflick // Jan 23, 2005 at 03:16 PM

    I get the same pain developing in both Tcl and Perl.

    To add insult to injury, my Perl colleagues make fun of my wierd spacing and bracketing inherited from Tcl!