I feel much better about it in 2024 than I did in any year prior, probably because I finally sat down to actually learn it and tk. I am enjoying it quite a bit and I no longer hate doing GUI stuff.
The older books which are still in publication seem to all be 8.5 or 8.6 and are relevant, I don't recall coming across anything which did not work yet but I am not exactly working through them cover to cover, used them to get the basics and am now using them more as a reference than a guide. Might not be the latest and greatest methods but will get you going. Probably nearing end of life since 9 is in beta, hopefully they will get updated.
I like Tcl. It's still very common in the electronics design industry, and it's a fun language to write things in. Kind of feels halfway in-between LISP and Bash. Tcl is also found in Python (weirdly) as the implementation language of Tkinter.
It's not exactly a popular language these days, but it has its niches. It has a small runtime with an event loop and a nice GUI extension. It's stable, easy to embed into other programs, easy to write, supports networking and all kinds of OS operations, and has a large body of libraries and examples out there. Its performance is also pretty reasonable these days.
These days, I think that Lua and Python are more common as extension languages - and that's totally fine. But there will always be room in my toolbox for Tcl.
IMO, it has the best ergonomics among scripting languages for embedding into native applications. I'm using it as a serialization format for a game, with the JimTcl interpreter. It's easy to create fluent hierarchical structures that straddle the line between code and data:
Indeed, one point that's often missed about Tcl is that the ability to treat code as data makes it easy to use metaprogramming techniques that are awkward or impossible in most other languages.
It's really sad that Tk has gotten a lot less love in recent years. With the advent of multi-megabyte UI frameworks (one is named for a subatomic particle), we have forgotten the benefits of a small, well-documented UI interface that is highly portable across OSes and architectures, and whose API can be invoked from virtually any language, with only a thin wrapper (I routinely use Tk from Scheme, for example).
Yes, Tk UIs nowadays look kind of clunky, and they don't cover the entire span of things that a UI should manage. Neither of these is a fatal flaw; if somebody wanted to put in a small amount of money, both could be easily addressed. Since there is apparently no prospect of this happening, I expect Tk to fall further and further behind. Shame.
Personally part of what drew me to Tk is the old clunky aesthetic which ended up freeing me from fighting the QT or GTK or what ever aesthetic which tends to work against the things I want to do and caused me endless grief. Tk just works for me and I can mostly forget about themes, just make my UI and get on with it.
I should have mentioned the themes, I agree they're an advance. But some people like really flashy UIs, some of which might not be easily achievable with Tk. I too tend to like retro UIs, and everything I want is achievable in Tk.
Re Scheme: you can do anything in Tk from Scheme as in any other language, if you're willing to use the Tcl (text-based) interface, as I do. The ease of interfacing to Tk via Tcl is one of the things I like most (I imagine somebody could do it from Cobol!), although there is a C interface as well.
I'm not particularly fond of Tcl as such (though one year I used it in the software engineering course I used to teach), but the integration of Tcl and Tk is a thing of beauty.
Tk is definitely not for flashy UIs but I don't think it should be called clunky anymore.
I loathed Tcl until I started into Tk, still causes me some grief but as a hobbyist the headaches of Tcl tend to be considerably smaller and easier to solve than the headaches of things like QT, wxWidgets, etc or even Tk from another language, which all left me spending more time looking for answers than programming. Tcl is growing on me, it and Tk are small enough that I can actually learn them well (at least well enough that I can generally answer my own questions), which is a huge plus for those of us who are learning to program in our freetime for our own projects. I can see why the professional programmers tend to push against them, there are better alternatives to Tcl these days and it will not be easy to create those flashy professional looking applications which draw in the consumers with Tk. Very much function over form here.
We’re using tcl’s Androwish build, to write tablet apps for Android to control our espresso machine, and the app runs nicely on Mac/win/linux “for free” and also makes app development more pleasant.
Distribution of an app with source easily modified (no build step) encourages tinkering.
Androwish also has a cool mp4 casting mode which replaces the screen rendering, that lets you use your app inside a web browser. https://www.youtube.com/watch?v=2GBmB6JSDnQ
https://www.mistachkin.com/joe/ has been talking about setting up a Tcl Foundation and to use that to try to corral corporate donations toward further development. I think it’s a good idea and I’m trying to help. I’d recommend contacting Joe if you’d like to help.
Apart from the Tk and Expect extensions, one of the best parts of Tcl its general extensibility through the Tcl C API. Unfortunately, this is one of Tcl's less well-documented features. Most books and online tutorials either ignore it completely or, at best, provide perfunctory discussion and examples.
The other poorly documented feature is the objected-programming framework which was belatedly added after Tcl fell out of the mainstream of programming languages and so languishes unused.
The biggest problem of all is that that there is no online forum for Tcl users now that Google has dropped Groups. Usenet comp.lang.tcl was the main discussion forum and it is now gone.
Comp.lang.tcl is still alive. If you don't want the hassle of setting up an nntp client, you can use the web interface I operate at https://cmacleod.me.uk/ng/comp.lang.tcl .
16 comments
[ 0.22 ms ] story [ 23.7 ms ] thread8.6.14 released February of this year, with 9.x beta May 2024.
Tcler's Wiki has recent posts:
https://wiki.tcl-lang.org/
Still hoping the older books are relevant.
The older books which are still in publication seem to all be 8.5 or 8.6 and are relevant, I don't recall coming across anything which did not work yet but I am not exactly working through them cover to cover, used them to get the basics and am now using them more as a reference than a guide. Might not be the latest and greatest methods but will get you going. Probably nearing end of life since 9 is in beta, hopefully they will get updated.
It's not exactly a popular language these days, but it has its niches. It has a small runtime with an event loop and a nice GUI extension. It's stable, easy to embed into other programs, easy to write, supports networking and all kinds of OS operations, and has a large body of libraries and examples out there. Its performance is also pretty reasonable these days.
These days, I think that Lua and Python are more common as extension languages - and that's totally fine. But there will always be room in my toolbox for Tcl.
Yes, Tk UIs nowadays look kind of clunky, and they don't cover the entire span of things that a UI should manage. Neither of these is a fatal flaw; if somebody wanted to put in a small amount of money, both could be easily addressed. Since there is apparently no prospect of this happening, I expect Tk to fall further and further behind. Shame.
https://tkdocs.com/tutorial/styles.html
Personally part of what drew me to Tk is the old clunky aesthetic which ended up freeing me from fighting the QT or GTK or what ever aesthetic which tends to work against the things I want to do and caused me endless grief. Tk just works for me and I can mostly forget about themes, just make my UI and get on with it.
Re Scheme: you can do anything in Tk from Scheme as in any other language, if you're willing to use the Tcl (text-based) interface, as I do. The ease of interfacing to Tk via Tcl is one of the things I like most (I imagine somebody could do it from Cobol!), although there is a C interface as well.
I'm not particularly fond of Tcl as such (though one year I used it in the software engineering course I used to teach), but the integration of Tcl and Tk is a thing of beauty.
I loathed Tcl until I started into Tk, still causes me some grief but as a hobbyist the headaches of Tcl tend to be considerably smaller and easier to solve than the headaches of things like QT, wxWidgets, etc or even Tk from another language, which all left me spending more time looking for answers than programming. Tcl is growing on me, it and Tk are small enough that I can actually learn them well (at least well enough that I can generally answer my own questions), which is a huge plus for those of us who are learning to program in our freetime for our own projects. I can see why the professional programmers tend to push against them, there are better alternatives to Tcl these days and it will not be easy to create those flashy professional looking applications which draw in the consumers with Tk. Very much function over form here.
Distribution of an app with source easily modified (no build step) encourages tinkering.
Androwish also has a cool mp4 casting mode which replaces the screen rendering, that lets you use your app inside a web browser. https://www.youtube.com/watch?v=2GBmB6JSDnQ
The other poorly documented feature is the objected-programming framework which was belatedly added after Tcl fell out of the mainstream of programming languages and so languishes unused.
The biggest problem of all is that that there is no online forum for Tcl users now that Google has dropped Groups. Usenet comp.lang.tcl was the main discussion forum and it is now gone.
There is also a fair amount of activity on the Tcl Wiki: https://wiki.tcl-lang.org .