7 ms·
Where Tcl and Tk Went Wrong
- lucidguppy 15y agoTCL/TK had so much going for it. It would have been a good alternative to making a scripting language for Netscape 2.0. (OOP could have been added later) Could the tk namespace pattern have been mapped to the DOM? It's funny how promotion and benefactors matter so much. Another example is how python-flask was originally an April Fool's Day joke that became popular. http://lucumr.pocoo.org/2010/4/3/april-1st-post-mortem/ http://lucumr.pocoo.org/2010/4/3/april-1st-post-mortem/ The one golden quote from this is... "It does not matter how good intended or well written a project is, the bold marketing is king. "
- bborud 15y agoI'm usually a patient man, but after reading several paragraphs of that article and it still going nowhere, I gave up. I think that if the author managed to summarize what he was trying to say in one or two paragraphs, it might be easier for me to decide if the verbiage is actually worth my time. I read about half of the article before my annoyance surpassed my curiosity. Come ON! This is constructive feedback.
- davidw 15y ago> This is constructive feedback. Not really. Some stories, such as those involving hundreds of people over the years, many companies, countless person-hours of work, and lots of money, are long and complex with many details and cannot be summed up in one or two paragraphs. I mean, you could say about my article that the key point is "marketing is important", but you'd be missing out on many details. Lord help us if you're ever confronted with something like...shudder... a book! Some contain thousands upon thousands of twisty paragraphs, not at all alike. Or, as a mediocre man once said, in the future, "There was a time when reading wasn't just for fags. And neither was writing. People wrote books and movies. Movies with stories, that made you care about whose ass it was and why it was farting. And I believe that time can come again! "
- bborud 15y agoI strongly disagree. Being brief and to the point is difficult and requires hard work, and it is impolite to assume that what you have to say is so important that other people should be expected to read the whole thing before being able to decide if it is relevant to them. The article in question would benefit greatly from a summary that allows the reader to decide if reading the whole thing is worth the effort. In scientific publishing an abstract is part of good form. In journalism the structures are usually less formal, but a good journalist will sell you a lengthly article without requiring you to read the whole thing. I have been criticized for writing at length and being bad at summarizing myself. I know it is hard. And of course I find it annoying when people point out how bad I am at writing. But you know what: it is extremely constructive criticism.
- davidw 15y agoI was brief and to the point, though. There's a lot of material to cover and I did so fairly quickly. I figured the title was enough to give away the general gist of the article: it's about a programming language and the problems it had. If that's a subject that interests you, perhaps the article is worth a read. I wrote the article to talk about a subject I know well, for people interested in that subject. tl;dr: not everything can be dumbed down to TV-style sound bytes.
- bborud 15y agoIf you were to submit a paper to a conference or a journal and they asked you to provide an abstract -- would you be offended? Why not? When you read ACM or IEEE journals, do you see the abstracts as "dumbing down to TV-style sound bytes"?
- davidw 15y agoLet's put it this way: if you can't figure it out from the title of the article, it's just not for you. The article was not meant for people with a casual interest in the subject, but those who wanted to know about the details. If that's not you, so be it. I would note, however, that at this point you've surely spent more time complaining here than it would have taken you to read the entire article.
- rpeden 15y agoI'm saddened by the lack of patience I'm starting to see among commenters recently. The article wasn't that long; I finished it in a few minutes. If you're unwilling to finish it, that is okay. Coming here to complain about the length of a relatively short article doesn't add to HN, however; it just clutters up the discussion for those of us who read end enjoyed the entire thing.
- SimHacker 15y agoAs I programmer, I have to slog though reading a lot more lines of code that are a lot less interesting than that article.
- rpeden 15y agoI've dabbled in Tcl a few times, and I really like it. The author talks about the ease with which the language's syntax can be extended. For me, this gives me the same feeling I get when I'm using Lisp. I'm aware of the large differences between the languages, but the feeling of freedom they both provide makes using them flat-out fun.
- perlgeek 15y agoBoth Lisp and Tcl are "everything is a-" languages. In Lisp, everything is a list. In Tcl, everything is a string. (For some values of "everything"). I guess that's really the key to allowing easy syntax extensions; it means that programs are represented in the very core data type, and you have lots of tool to manipulate it.
- veyron 15y agoIn fact, it's actually simpler to expose C components using Lua than Tcl.
- mechanical_fish 15y agoThere is some interesting stuff here, but if you want a one-sentence explanation of why Tcl has declined I'd suggest: It doesn't have a hook. What does Tcl offer? Half this article is about Tk, but Tk is (a) a generic GUI toolkit, and therefore competing directly against everything from Java Swing to Flash to (the big winner) HTML/JS/CSS. And (b) not Tcl-specific, right? Didn't I see Perl bindings for Tk go by? As an embeddable language Tcl somehow got eclipsed in the branding battle by Lua (don't ask me why; not my field, all I can do is repeat glib rumors) and in web-app land it got crushed by PHP just like Perl did. If you want to toy with extensible syntax in your language you can use Ruby DSLs; if you want the real thing you go to a Lisp. Tcl's a lousy language for mathematics and I can't imagine replacing a shell script with it (I think I vaguely remember a Tcl shell, but maybe I dreamed that, because it has no mindshare). It doesn't run in the browser. So what is Tcl for? Just tell me in a sentence. And, no, "being a nice average general-purpose language" is not a brand worth anything.
- davidw 15y ago> I can't imagine replacing a shell script with it I can and have. Whenever a shell script starts getting at all complex, I grab a scripting language. These days it's Ruby, but in the past it was Tcl, and it did a fine job: it has a bunch of built in commands that are convenient for system tasks, and plays very nicely with the environment it lives in. So, quite the contrary: due to the OO (although this is being fixed) and 'GC/reference' problems, I'd be more concerned about big systems in Tcl, and not at all with little scripts, where it still is an excellent choice. You're quite right about "the web" being the big winner in terms of "cross-platform toolkits" and as a bonus deployment is also way easier. Tcl can do the web though. See: http://flightaware.com/ http://flightaware.com/ . But of course in that field, things didn't play out like they did with Tk, where it was probably the most popular option. Also, while I use Ruby these days quite happily, Tcl has it beat in terms of DSL's, IMO, due to the extreme simplicity/plasticity of the syntax. Why Lua (probably deservedly) started beating Tcl in the 'embedding' space is covered in the article. Python, by the way, does pretty well with being a "nice average general-purpose language", although I do sense some envy on their part over the popularity of things like Ruby on Rails. So I do and I don't agree with your conclusion. If Tcl were where Python is today, it would be a much healthier language, even if not the biggest thing out there. Also, by having a 'reservoir' of people using a language, you're more likely to get someone doing something that turns into a big hit.
- adunsmoor 15y agoI'm a long time Tcl/Tk user - it's still the defacto standard in the electronic design automation industry. My own tl;dr for this comment: David makes good points and his experience mirrors some of my own. I think the biggest mistake was not going with a "batteries included" strategy for Tcl releases. 1) Tk got left behind by Qt, GNOME, etc. I whole-heartedly agree with this. We spent a very long time making our Tk apps fit in on user's Linux based desk tops - tweaking color schemes, widget dimensions, and even adding new widgets that Qt and and GNOME had that Tk didn't (trees, tables, buttons that could show images and labels, for example). Tk has since made this a lot easier but at the time it was frustratingly time consuming. The author's other point that there were too many ugly Tk apps. Maybe. You definitely could spot a Tk app a mile away. But there are plenty of ugly X apps where X is any GUI framework so I don't buy in to that theory as much. 2) The debate between making Tcl batteries included or not. In think this is the #1 issue. I love Tcl for quickly stitching together a few apps or processing files. Tcl makes working with the system really easy and it's "everything can be a string" roots can be tremendously useful. But... if you want to do something that's not in the core language - you had to build it yourself. There were quite a few useful external packages but they were often incompatible or tied to specific versions of Tcl etc, etc. Comparing that to the first time I built something in python and needed to process a gzipped file. Just import zlib. Wow! Every big Tcl project I'm aware of had to devote a lot of energy adding support for some fairly basic - in comparison to other scripting languages - features. Tcl's philosophy was very much like the C language. Keep the core small - let the users work out the rest. 3. Missing default support for object orient programming. Sure. Maybe. That kind of goes with point 2 above. It wasn't ever so much of an issue for me or any of the projects I worked on. 4. Missing support for some modern conveniences (no PNG, no readline based shell) Sure. It goes with the batteries included or not theme. It was (and still is in some cases) a sign that tcl was falling behind. 5.Everything must be representable as a string I spent a lot of time dealing with this. It's incredibly convenient when writing Tcl scripts. It's incredibly difficult when writing C extensions. The Tcl_Obj structure is actually really clever but managing the life cycle of objects is frustratingly complicated. This is advanced enough of a feature that I don't think it impacts that many people. That said, fixing this flaw might have allowed for more interesting extensions. 6. (I'll add one of my own.) Multi-threaded tcl is not built in. You have to make the choice at compile time. Compiling in support for threads slows down tcl enough to be noticeable for the kinds of people that are interested enough to do multi-threaded programming with Tcl. :-)
- viraptor 15y agoI tried to use Tcl a couple of times and resigned very quickly, for a similar reason I don't like bash for non-trivial scripts. It's the strange quoting rules that can cause some text to become an expression which is executed. It's just an accident waiting to happen and I kept running into that many times. 'expr' seems like an eval that you can't get rid of. I'm a bit surprised how language feature like this became the standard way of doing basic things. How is parsing "code strings" at runtime ever better than building an ast and handling variables as variables?
- NelsonMinar 15y agoWhat's replaced Tk for an easily scriptable, cross-platform GUI language? What I see the most in practice is PyGTK, but it's pretty hard to love. Javascript+HTML is probably the most capable alternative but the lack of a simple container for native-feeling apps is really limiting. I was surprised to learn Lua has quite a robust series of GUI options, but I've never seen it actually used.
- davidw 15y agoLike mechanical_fish says, lots of people have migrated to the web. Others use Qt, although it has some licensing limitations, or used to at least. Plenty of people interested in getting stuff done still use Tk, be it with Tcl or some other language, quite successfully. It does look better these days.
- veyron 15y agoWhat really happened was that the core functionality of Tk was ported to other languages (for python, check out Tkinter), so you can leverage the power of Tk elsewhere. As a result, you have to look at Tcl in comparison to Python and other languages. At the end of the day, Tcl fell out of vogue.
- maxerickson 15y agoPython accesses Tk by shipping a Tcl interpreter. (which doesn't really change your point, but Tcl is directly involved there)
- makomk 15y agoIf memory serves me correctly, Tkinter even exposes you to Tcl sometimes if you want to do more advanced things, though I can't remember now why I needed it.
- henry_flower 15y agoThe best description of Tcl state is that its creator John Ousterhout now teaches students how to write web apps in Rails. It's like Larry Wall would write a book about Django.
- nirvana 15y agotl;dr: Rails is the killer app for Ruby. Your open source project needs a killer app. I spent several years as a TK/TCL programmer. I believe where Tcl "went wrong" is that it never got attached to a very high profile use case or project. It is not enough that the language was open source-- it needed to be used in a major open source product (or a major product period, the way flash is major, and thus ensured a life for lingo/actionscript, etc.) There was no Rails for Tcl like there was for Ruby. There was no Django like there was for python. There was no iPhone like there is for iOS, or massive number of open popular open source products like there is for Java. I can barely remember anything of Tcl. It didn't make a big impression on me, even though I wrote it full time for a couple years at a job back in the day. This is not true of other languages- Every language I've had to use full time has become my favorite language. At one point it was Java, then I discovered Objective-C and that became my favorite language, then I got into erlang, and now that is my favorite language (though it shares a spot with Obj-C because I use them for different things.) Tcl never made a big impression- it never gave me the big epiphany of a better way to do something that the other languages have (message passing in Objective-C makes it the best OO language in my opinion, and erlang's concurrency is unmatched, in my experience, though I don't claim to be an expert.) Finally, the big claim to fame that Tcl had, was TK. Tcl programmers talk about TK a lot- notice how this article does. Unfortunately, the problem TK is trying to solve is essentially unsolvable in a good way. Sure, you can make a cross platform GUI toolkit, many have, but you then have to decide if you make your program look the same on each platform (and thus not like that platform) or if you try to make it look like the platform, in which case you run into all kinds of issues (because each GUI platform is based on seriously different design choices and thus having one bit of code support contradictory design choices on the different platforms is difficult. You can abstract a lot of it, but not all of it.) In the end, these cross platform apps never quite look right. Perfectly fine for Enterprise software (part of the reason Java found such success there) but never really delivering for the commercial shrink-wrapped market, which needed each platform app to look just right for that platform. The two big lessons I take away from this for any open source project is- 1. Have a clear compelling feature that you absolutely nail. Be the go-to place for that feature (as TK tried to be.) 2. Do everything you can to make sure there's some high visibility adoptions of your project in other projects or products.
- TheoLib 15y agoI was a long-time Tcl user and loved it. [incr Tcl], incidentally, is not a play on "+=1", but "++"; i.e., [incr Tcl] is to Tcl as C++ is to C. Speaking of event loops, before Tcl had its own event loop, I wrote a select()-based event loop extension to Tcl that was similar to the Xt event loop. For that, I was (or still am for all I know) listed as an extension contributor in the Tcl/Tk FAQs. [incr Tcl] was a great OO framework for writing GUIs. Perhaps not the greatest framework since it was trying to mimic C++. As antirez said, "It's like learning Scheme or FORTH: mind changing."
- hp 15y agoBack in the era this is talking about, I ported the Tk text widget over to GTK+ which became GTK's still-used text widget (GtkTextView). I think the author is right that it was a mistake to ignore Linux. It didn't have the desktop user marketshare, but it did have the developers that were doing a lot of the work on open source code. Even at that time (just before GTK+ 2.0, around 2001), expected toolkit features had jumped ahead of Tk quite a bit; in porting the widget I think I added model-view separation, pixel-based (vs. line-based) scrolling, international text layout, input methods, accessibility, lots of optimizations, support for non-XPM images... likely more I can't remember. Tk lacked all that stuff, and various GTK-related companies and Troll Tech (Qt) were investing in building all of it for GTK and Qt. That led to a situation where only those two toolkits, that had been modernized, were acceptable to lots of decision-makers who were deciding what to ship with Linux distributions or GNOME or KDE. Nobody could afford to go modernize Tk also, it was easier to just get all the apps on one or two toolkits. The modernization work was being funded or volunteered-for with Linux in mind, nobody cared to do it for open source toolkits on Windows or Mac. Swing was probably the only cross-platform toolkit that had the same modernization work done. (Ignoring "wrapper" toolkits like wxWindows or SWT that have whatever modernization is found in the toolkit they wrap.) The Tk text widget was a solid piece of work, I mean, it's an accomplishment to write code good enough that it makes sense to port it to another toolkit. The core btree data structure from Tk is in GTK to this day with extensions but no real major overhaul: http://git.gnome.org/browse/gtk+/tree/gtk/gtktextbtree.c http://git.gnome.org/browse/gtk+/tree/gtk/gtktextbtree.c I think Ousterhout may have written it. It's an interesting data structure if you like that sort of thing. The older GTK text widget had various operations that were O(n), and so people kept writing O(n^2) or worse code accidentally; with the new one, one of the goals was to try to keep everything below O(n) so it was harder for developers to hose themselves. The core of this was the btree from Tk. One place we declared defeat was in very long lines; some stuff is still O(n) where n is the line length, and that's hard to fix without massive overhaul. The btree is about storing lines and related metadata so that things aren't O(n) in number of lines. There's also a useful trick in http://git.gnome.org/browse/gtk+/tree/gtk/gtktextiter.c http://git.gnome.org/browse/gtk+/tree/gtk/gtktextiter.c where an incrementing "change stamp" is used to keep an iterator valid even though the iterator caches some pointers that can become invalid as the btree changes. Sorry for the "used to walk both ways in the snow"-flavored post ;-)
- njharman 15y agoAuthor is right. Right or wrong Tk' least common denominator old ass, crusty, motif look kept me away. Little I saw back then, 90's, "advertised" any use of tcl outside ok Tk. In fact it was almost always called tcl/Tk. Languages need mindshare and to get mindshare you need marketing and tcl suck[ed|s] at marketing. Unlike python, ruby, lua.
- dasil003 15y agoIs it really that much worse than Lua's marketing? I figured Lua just took off because it's niche is much more clear cut and there's less competition.
- davidw 15y agoI'm talking about marketing more in the sense of "finding out what people are doing with your stuff, and moving your product in a direction that helps them" than "SELL! SELL! SELL!", which you really can't do with open source in any case. The embedded vs batteries included example is a pretty good example of that: Tcl is neither small and limited/self-contained like Lua, nor does it ship with a bunch of stuff out of the box. So it satisfies no one.
- lrobb 15y agoWhat a memory flashback... I made the decision to focus on low level C++ / Windows right around the time tcl/aolserver was cutting edge. I think my career advice for younger programmers is to stay away from whatever technologies I'm using.
- aninteger 15y agoJust curious, why? I personnally have almost 0 interest in web programming. What would you recommend for younger programmers that hate web stuff?
- KingMob 15y agoFor me, the crufty nature of Tk's Motif-style appearance was the major factor. I used Tcl/Tk heavily in my 3D graphics class back in 1998, and while I enjoyed its light weight and ease of use, I felt that the GUI output was definitely old-school compared to Gtk and Qt, and had no desire to continue using Tcl/Tk after the class ended. It felt like the past.
- quatrevingts 15y agoFrom a language design standpoint, Tcl is simple and beautiful. You can read its entire semantics in its rather short man page. It's got the homoiconicity of Lisp (with strings instead of lists) which enables very flexible syntax extension. Its simplicity also allows it to be embedded rather easily. Unfortunately, it's too simple, in one fundamental way which makes the language very flawed: it does not have closures. Callbacks (which are fundamental to I/O or GUI work) are executed from a scope which has access to nothing but global variables. As a result, users of the language must either stash everything in globals, or else perform awkward explicit variable substitution, taking care to distinguish between variables to be evaluated in the present context and variables to be evaluated in the callback context and escape them appropriately (like writing a Lisp macro, but this is in every callback.) And if you want to implement any higher-order functions, say filter by predicate, you have a problem because you want to pass an argument to the predicate, but you also want the predicate to have access to variables in the scope where it was defined. The predicate is not a first-class function: it's a block of code that you can eval. In fact, you can eval it anywhere on the call stack. That's right: Tcl gets the job done using functions which evaluate blocks of code in their caller's context. If that sounds scary, good, it is.
- deleted 15y ago[deleted]
- davidw 15y agoIt certainly has warts. But it's not bad for something from the late 80ies (my guess is that Tcl is older than a small but significant number of this site's users), and I don't think language design is a key component in being popular / having a healthy community. Exhibits A and B: PHP and Java.
- quatrevingts 15y agoI think Tcl is beautiful example of a certain point in the design space and extremely useful pedagogically. It's not that it has unnecessary deformities (warts) the way that PHP does. Someone could make a much better PHP than PHP by just cleaning up a bunch of nonsense that's only there because its designer didn't know what he was doing. I don't think that's the case with Tcl (or Java, for the most part.) It's just that solving a complex problem with a simple tool can often be more complex than solving it with a complex tool, even if the complex tool requires a bit more up-front learning. Working with Tcl makes it very clear that spending some of your complexity budget on closures pays off big. As far as what makes for a popular language, clearly corporate support is the key factor in some cases, good libraries in others, but I can't really explain the rise of Python except by its design.
- blacksqr 15y agoOtra vez!
- kbd 15y agoEvery time I'm reminded of Tcl's history through Sun I wonder how much would have had to have been different for Tcl to have ascended instead of Java. Was it the decision of one man who just liked Java better? Was it for more technical reasons (like the lack of a standard OO system)... etc? I don't know Tcl well, but I still feel like a different present in which Tcl had arisen to be one of the most popular languages may have been better than the actual Java-dominated present.
- lmm 15y agoFor a long time I thought that way, but Java has a killer feature that everything else is missing: it's really hard to write java extensions in C/C++, and thus it's near-impossible to crash your runtime. I think that combined with its C-like syntax was always going to ensure Java's success in the enterprise. The other thing that makes it good for large systems is that Java was designed from the ground up for running untrusted code. I know the python module that attempted to offer the same functionality has been abandoned as basically unworkable. (Though interestingly this is one of the things that Tcl did well - safe Tcl actually worked, afaik).
- patorjk 15y agoI used Tcl a lot at my former job, it's a fun language. The architect of the project I was on picked it, and I got see a dozen or so people's introduction to the language. These may seem like nit picks, but for newbies, these appeared to be the biggest issues: 1) People hated pronouncing it "tickle", and would almost always initially call it T-C-L. This seems minor, but people have egos and if the name is silly, it's going to hurt in adoption. 2) Comments (#) are actually commands, and you can't simply comment out blocks of code. 3) There was no buzz or heat around the language, nothing exciting seemed to be happening with it. This led a lot of people to thinking it a waste of time to learn.
- davidw 15y agoComments are not actually commands, but... yes, you can't just do something like # if { $foo } { ... Because the open brace will cause problems.
- msluyter 15y agoI worked with expect (tcl based automation tool) for a while back in the 90's and while I really liked expect for what it could accomplish, tcl itself annoyed me. I can't really articulate why (perhaps just the overwhelming prevalence of {} characters?) I also found pass by name semantics sort of weird, but on the other hand, I was much less mature then than I am now, so I can't really trust my own impressions. Expect is still pretty neat: http://expect.sourceforge.net/ http://expect.sourceforge.net/
- __david__ 15y agoMy absolute favorite thing about Tcl is its simplicity. Just do "man Tcl" (it's built in to Mac OS X). That one man page describes the entire language and it's only 12 paragraphs long. There's a wonderful simplicity and symmetry that comes from the core "everything is a string" tenet. That said, I haven't used it for a new project in over 10 years. I still kind of miss it though...
- rogerbinns 15y agoHow about almost being Javascript? In 1994 I gave a talk and demo at the Second WWW Conference with TCL integrated into Mosaic. It performed the same functions as Javascript later did, and was a very good match also being string based. (ie it was embedded in the page and could control page display and actions.) Even got massive applause from the crowd. Although it was embedded in our browser (IXI Mosaic) as standard, Netscape was formed at the same time, got huge market share and did their own thing. But TCL could have been a contender ... I personally switched from TCL to Python in 2000. The lack of a standard way of keeping data and the methods that operate on it together ("object orientation") made larger projects too clumsy.
- zem 15y agoone thing tk got very right was a superb vector canvas. it blew my mind when i realised how easy it was to draw shapes on the canvas and have them respond individually to mouse clicks.
- razzmataz 15y agoI always felt that the syntax was painful to work with - it reminded me of scripting with csh way too much. That's not to say Tcl/Tk didn't have areas where it would shine brightly back in the day. Those would be Expect and Tk. When you needed to 'automate' accessing hosts or devices via telnet, Expect could do that and then some. And Tk was probably the easiest way to create a GUI on the fly for unix and linux. I know that most of the management and configuration apps for UnixWare 2 and 7 were written in visual tcl, a curses enhanced version of tcl, which made dealing with UnixWare less painful. Unfortunately, there aren't really any big killer apps written with tcl, and I haven't seen any major new books (a 2nd edition of Ousterhout's book and one or two others). I suppose it's better than the situation that Eiffel is in, though.
- danbmil99 15y ago(looks at watch) pretty soon we'll see the "whatever happened to FORTH?" post troll by. It's Groundhog Day all over again.