TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Where Tcl and Tk Went Wrong

120 点作者 m_for_monkey超过 13 年前

23 条评论

mechanical_fish超过 13 年前
There 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.<p>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?<p>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.
评论 #3579318 未加载
评论 #3579595 未加载
评论 #3579259 未加载
评论 #3579302 未加载
评论 #3579577 未加载
quatrevingts超过 13 年前
From 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.<p>Unfortunately, it's <i>too</i> 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.)<p>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.
评论 #3580177 未加载
评论 #3579965 未加载
rpeden超过 13 年前
I've dabbled in Tcl a few times, and I really like it.<p>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.
评论 #3579497 未加载
评论 #3579518 未加载
rogerbinns超过 13 年前
How 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.<p>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 ...<p>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.
henry_flower超过 13 年前
The best description of Tcl state is that its creator John Ousterhout now teaches students how to write web apps in Rails.<p>It's like Larry Wall would write a book about Django.
hp超过 13 年前
Back 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).<p>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.<p>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.<p>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.)<p>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: <a href="http://git.gnome.org/browse/gtk+/tree/gtk/gtktextbtree.c" rel="nofollow">http://git.gnome.org/browse/gtk+/tree/gtk/gtktextbtree.c</a> I think Ousterhout may have written it.<p>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 <a href="http://git.gnome.org/browse/gtk+/tree/gtk/gtktextiter.c" rel="nofollow">http://git.gnome.org/browse/gtk+/tree/gtk/gtktextiter.c</a> 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.<p>Sorry for the "used to walk both ways in the snow"-flavored post ;-)
评论 #3579915 未加载
kbd超过 13 年前
Every 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.<p>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?<p>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.
评论 #3579920 未加载
__david__超过 13 年前
My 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.<p>That said, I haven't used it for a new project in over 10 years. I still kind of miss it though...
KingMob超过 13 年前
For me, the crufty nature of Tk's Motif-style appearance was the major factor.<p>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.
adunsmoor超过 13 年前
I'm a long time Tcl/Tk user - it's still the defacto standard in the electronic design automation industry.<p>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.<p>1) Tk got left behind by Qt, GNOME, etc.<p>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.<p>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.<p>2) The debate between making Tcl batteries included or not.<p>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!<p>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.<p>3. Missing default support for object orient programming.<p>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.<p>4. Missing support for some modern conveniences (no PNG, no readline based shell)<p>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.<p>5.Everything must be representable as a string<p>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.<p>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.<p>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. :-)
评论 #3579492 未加载
评论 #3579459 未加载
评论 #3580249 未加载
评论 #3579951 未加载
评论 #3579509 未加载
评论 #3579325 未加载
评论 #3579952 未加载
TheoLib超过 13 年前
I 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.<p>[incr Tcl] was a great OO framework for writing GUIs. Perhaps not the greatest framework since it was trying to mimic C++.<p>As antirez said, "It's like learning Scheme or FORTH: mind changing."
razzmataz超过 13 年前
I 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.<p>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.
patorjk超过 13 年前
I 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:<p>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.<p>2) Comments (#) are actually commands, and you can't simply comment out blocks of code.<p>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.
评论 #3582003 未加载
viraptor超过 13 年前
I 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.<p>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?
msluyter超过 13 年前
I 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.<p>Expect is still pretty neat:<p><a href="http://expect.sourceforge.net/" rel="nofollow">http://expect.sourceforge.net/</a>
NelsonMinar超过 13 年前
What'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.
评论 #3579474 未加载
评论 #3579515 未加载
njharman超过 13 年前
Author 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.<p>Languages need mindshare and to get mindshare you need marketing and tcl suck[ed|s] at marketing. Unlike python, ruby, lua.
评论 #3579633 未加载
lrobb超过 13 年前
What a memory flashback...<p>I made the decision to focus on low level C++ / Windows right around the time tcl/aolserver was cutting edge.<p>I think my career advice for younger programmers is to stay away from whatever technologies I'm using.
评论 #3584211 未加载
zem超过 13 年前
one 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.
danbmil99超过 13 年前
(looks at watch) pretty soon we'll see the "whatever happened to FORTH?" post troll by. It's Groundhog Day all over again.
nirvana超过 13 年前
tl;dr: Rails is the killer app for Ruby. Your open source project needs a killer app.<p>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.<p>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.<p>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.<p>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 <i>that</i> 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.)<p>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.<p>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.)<p>2. Do everything you can to make sure there's some high visibility adoptions of your project in other projects or products.
评论 #3579678 未加载
blacksqr超过 13 年前
Otra vez!
bborud超过 13 年前
I'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.<p>I read about half of the article before my annoyance surpassed my curiosity. Come ON!<p>This is constructive feedback.
评论 #3579212 未加载
评论 #3579217 未加载