Comments on: 10 Things I Hate About Tcl http://tleaves.com/2004/10/20/10-things-i-hate-about-tcl/ Creativity x Technology Sat, 17 Mar 2012 05:09:58 +0000 hourly 1 http://wordpress.org/?v=3.3.1 By: Mike http://tleaves.com/2004/10/20/10-things-i-hate-about-tcl/comment-page-1/#comment-686 Mike Mon, 13 Mar 2006 01:53:27 +0000 http://tleaves.com/?p=215#comment-686 >In short: Tcl combines concepts from Lisp, C, and shells. Yes, the worst ones. >In short: Tcl combines concepts from Lisp, C, and shells.

Yes, the worst ones.

]]>
By: Richard Suchenwirth http://tleaves.com/2004/10/20/10-things-i-hate-about-tcl/comment-page-1/#comment-685 Richard Suchenwirth Thu, 20 Jan 2005 18:14:28 +0000 http://tleaves.com/?p=215#comment-685 Disclaimer first: I love Tcl. Having gone through Fortran, Pascal, Basic, C, Logo (my previous darling), and others, I discovered Tcl 9 years ago. I'm still looking around for a better language, but haven't found one yet. (Yes, I tried Perl and Python). But love and hate are emotions. Let's talk facts. Re 1.: "foo" is just a string (which could be the name of a variable. "$foo" is the value of the variable foo, as long known from shells. The difference between a name and a value ($) gets clearly distinguished. (In Lisp you'd need "special forms" to avoid evaluating everything...) Re 2.: Loop and if bodies, as well as procedures, are compiled to bytecode at first use (since Tcl 8.0). On later calls, only the bytecode is executed again. Re 3.: I'm often fixing bugs with a quick glance at the backtrace. They look clearer to me than Python's. Re 7.: [expr] was introduced as a compromise so expressions could be written in infix notation ($a + 1). It is easy to add prefix notation that's more in the Lisp/Tcl spirit, so one can write [+ $a 1] if one wishes. Re 8.: Conditions in [if], [while] and [for] are expressions, so it's a good move to give them an implicit [expr]. Re 9.: Every value has a string representation, and possibly one of another type, in parallel. Powerful data structures include lists (that can be nested to make matrices or trees), hash tables and dictionaries. In short: Tcl combines concepts from Lisp, C, and shells. And often it can be even more powerful than any of these. Disclaimer first: I love Tcl. Having gone through Fortran, Pascal, Basic, C, Logo (my previous darling), and others, I discovered Tcl 9 years ago. I’m still looking around for a better language, but haven’t found one yet. (Yes, I tried Perl and Python).

But love and hate are emotions. Let’s talk facts.

Re 1.: “foo” is just a string (which could be the name of a variable. “$foo” is the value of the variable foo, as long known from shells. The difference between a name and a value ($) gets clearly distinguished. (In Lisp you’d need “special forms” to avoid evaluating everything…)

Re 2.: Loop and if bodies, as well as procedures, are compiled to bytecode at first use (since Tcl 8.0). On later calls, only the bytecode is executed again.

Re 3.: I’m often fixing bugs with a quick glance at the backtrace. They look clearer to me than Python’s.

Re 7.: [expr] was introduced as a compromise so expressions could be written in infix notation ($a + 1). It is easy to add prefix notation that’s more in the Lisp/Tcl spirit, so one can write [+ $a 1] if one wishes.

Re 8.: Conditions in [if], [while] and [for] are expressions, so it’s a good move to give them an implicit [expr].

Re 9.: Every value has a string representation, and possibly one of another type, in parallel. Powerful data structures include lists (that can be nested to make matrices or trees), hash tables and dictionaries.

In short: Tcl combines concepts from Lisp, C, and shells. And often it can be even more powerful than any of these.

]]>
By: Ralph W. http://tleaves.com/2004/10/20/10-things-i-hate-about-tcl/comment-page-1/#comment-684 Ralph W. Tue, 26 Oct 2004 01:34:10 +0000 http://tleaves.com/?p=215#comment-684 I have to take exception with item 1. Remember, everything is a string (see item 9) and that includes program statements. That's the reason why you use dollar signs in some places and not in others. Tcl syntax is, in fact, very consistent. It's just that consistency is overrated. You know what they say about a foolish consistency.... What you're actually saying is that Tcl doesn't match the way you like to think about variables and program statements. That's as good a reason as any not to like Tcl. I have to take exception with item 1. Remember, everything is a string
(see item 9) and that includes program statements. That’s the reason
why you use dollar signs in some places and not in others.

Tcl syntax is, in fact, very consistent. It’s just that consistency is
overrated. You know what they say about a foolish consistency…. What
you’re actually saying is that Tcl doesn’t match the way you like to
think about variables and program statements. That’s as good a reason
as any not to like Tcl.

]]>
By: Jonathan Hardwick http://tleaves.com/2004/10/20/10-things-i-hate-about-tcl/comment-page-1/#comment-683 Jonathan Hardwick Thu, 21 Oct 2004 05:30:11 +0000 http://tleaves.com/?p=215#comment-683 Now now, be fair. It was only... hmmm... 12 years ago when I was upgraded to a DECstation 2100. Oh my god. TWELVE YEARS. Now now, be fair. It was only… hmmm… 12 years ago when I was upgraded to a DECstation 2100.

Oh my god.

TWELVE YEARS.

]]>
By: Dave http://tleaves.com/2004/10/20/10-things-i-hate-about-tcl/comment-page-1/#comment-682 Dave Thu, 21 Oct 2004 02:57:51 +0000 http://tleaves.com/?p=215#comment-682 Argh. Forgot to delete "It's even more elegant" while editing. -- Dave Argh. Forgot to delete “It’s even more elegant” while editing.

– Dave

]]>
By: Dave http://tleaves.com/2004/10/20/10-things-i-hate-about-tcl/comment-page-1/#comment-681 Dave Thu, 21 Oct 2004 02:54:23 +0000 http://tleaves.com/?p=215#comment-681 9. No real data structures to speak of. Everything is a string. Pick Basic (the programming language for Pick-style databases) does a very nifty string-as-data-structure trick. X = "A;B;C" CONVERT ";" TO @FM IN X CRT X<2> This turns the semi-colons in the string into Field Marks (@FM), then uses the field extract operator ("<>") to pull out a specific field. It's even more elegant It also does a very neat integer-as-string trick too: FOR X = 1 TO 1000 IF X[2] = "00" THEN CRT "*": END NEXT Here I'm using X as an integer in my FOR loop, then later on I'm using it as a string by using the substring operator ("[]"). This prints a * when the last two characters of X are "00", which is on every 100th pass through the loop. Plus it has other features, such as compiling (to bytecode, no less), printing out exactly where an error happened (but no backtrace), and a few others. And it dates back to sometime in the late 60s, IIRC. It has evolved in the meantime, of course, so things like bytecode might have come later. -- Dave 9. No real data structures to speak of. Everything is a string.

Pick Basic (the programming language for Pick-style databases) does a very nifty string-as-data-structure trick.

X = “A;B;C”
CONVERT “;” TO @FM IN X
CRT X<2>

This turns the semi-colons in the string into Field Marks (@FM), then uses the field extract operator (“<>”) to pull out a specific field. It’s even more elegant

It also does a very neat integer-as-string trick too:

FOR X = 1 TO 1000
IF X[2] = “00″ THEN
CRT “*”:
END
NEXT

Here I’m using X as an integer in my FOR loop, then later on I’m using it as a string by using the substring operator (“[]“). This prints a * when the last two characters of X are “00″, which is on every 100th pass through the loop.

Plus it has other features, such as compiling (to bytecode, no less), printing out exactly where an error happened (but no backtrace), and a few others.

And it dates back to sometime in the late 60s, IIRC. It has evolved in the meantime, of course, so things like bytecode might have come later.

– Dave

]]>