Breaking news: Tcl considered lacking in some areas

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.

1 comment

Mark Aufflick
 

I get the same pain developing in both Tcl and Perl.<p> To add insult to injury, my Perl colleagues make fun of my wierd spacing and bracketing inherited from Tcl!
Read more
Read less
  Cancel

Leave a comment