3 ms·
I don't think hackers hate Tcl because it's "intimidating". They hate it because it's verbose, slow, and lacking in abstraction power. (Last time I used it, a
by kragen 18y ago
I don't think hackers hate Tcl because it's "intimidating". They hate it because it's verbose, slow, and lacking in abstraction power. (Last time I used it, associative arrays weren't first-class, i.e. you can't have a list of anonymous associative arrays; is that still the case?) Also, Tcl was originally aimed at the niche that Lua now occupies — lightweight embedded scripting language — but Tcl is 720k of code while Lua is 82k, and isn't verbose, slow, or lacking in power. Finally, the libraries available for Tcl, while they do cover some pretty important stuff, are a tiny fraction of what's available for C, C++, C#, Java, Perl, Python, or even Ruby.
The article says it's "more or less as fast as ... Ruby". Well, that's pretty slow!
The string-substitution execution model is easy to explain, and it's easy to do higher-order programming with, but it's very error-prone and very difficult to implement efficiently. If you use Tcl in a disciplined way, you won't have too much trouble with this, but it is not nearly the advantage that this article makes it out to be.
Tcl does have some nice advantages: it's optimized for use as a UI with an embedded DSL, not for use as a programming language, and its support for event-driven programming and securely running untrusted code are first-rate. Yosef K. (Yossi Kreinin) recently blogged about some of this.
Oh, and you say, "# is a command that ignores its arguments". You're wrong about that; try "# [set x 3]" or "# comments do not end at semicolons; puts hello" if you don't believe me.
- pmarin 18y agoWell, Tcl is faster than Ruby and now we don't use the associative arrays we use the dict instead. What version of tcl have you used?
- kragen 18y agoYou seem to think that dicts aren't associative arrays. I think the last version I did any significant amount of work on was Tcl 8.3. But I wasn't any kind of expert on it then. It might be true that Tcl (8.6?) is faster than Ruby now, but the article that started this thread didn't dare to claim that, and these benchmarks of Tcl 8.5b3 don't support that claim: http://shootout.alioth.debian.org/gp4/benchmark.php?test=all&lang=tcl&lang2=yarv http://shootout.alioth.debian.org/gp4/benchmark.php?test=all...
- pmarin 18y ago# [set x 3] set x can't read "x": no such variable # puts hello --nothing happens-- What are you talking about?
- kragen 18y agoCompare the behavior of # to the behavior of puts. If you puts [set x 3], not only does it print out 3, it also sets x to 3. If you # [set x 3], it does not set x to 3, because # is not actually a command that ignores its arguments; it is a comment, just like in Python, Perl, or sh. Similarly, if # were a command, a semicolon would terminate it and start a new command, but it doesn't. The comment continues to the end of the line.
- gaius 18y agoIf # were a comment character in the language you could do this: % puts "hello" # hello bad argument "hello": should be "nonewline" But this works: % puts "hello" ;# hello hello That's the point; that nothing in Tcl is "special" or "reserved", everything is a command that takes parameters.
- kragen 18y agoI didn't remember that you can't have a comment inside of a statement, but you're still wrong! It's true that you can't have comments in as many contexts in Tcl as you can in most languages, but it is not true that they are just ordinary statements; ordinary statements evaluate their arguments. "#" comments don't evaluate their "arguments", don't terminate at semicolons, and you can't redefine the meaning of "#" with "proc", so "#" is special and reserved — just in fewer contexts than in other languages that use it as a comment character.