[HN Gopher] Tcl Tutorial
___________________________________________________________________
Tcl Tutorial
Author : Tomte
Score : 63 points
Date : 2025-03-16 18:48 UTC (4 hours ago)
(HTM) web link (www.tcl-lang.org)
(TXT) w3m dump (www.tcl-lang.org)
| hiAndrewQuinn wrote:
| I like Tcl a lot, especially the Expect module. If you've ever
| wanted an Autohotkey for your terminal (I promise that phrase
| actually makes sense) it's well worth your time to look into
| either Expect itself or Python's `pexpect` module.
| nuancebydefault wrote:
| I tought expect is a test framework
| AceJohnny2 wrote:
| Expect was born out of TCL, and its original syntax worked
| really well with TCL's.
|
| Its popularity led it to being ported to other languages,
| Perl & Python being the big ones, but TCL Expect is the og
| wizzwizz4 wrote:
| SQLite has the same origin story. (That's the reason for
| SQLite's confusing type system: it makes perfect sense as a
| Tcl type system.)
| pwg wrote:
| Expect is an automation framework. Automating tests is just
| one use for it.
| aerostable_slug wrote:
| I love Expect.
|
| Package owner: "These configuration choices are so important
| that a human _must_ be present at the keyboard every time,
| without exception. Woe would befall us all were the will of the
| ancients ignored. So it was written, so it shall be done. "
|
| Me: "Yeah, nah."
| zerr wrote:
| I skipped Tcl in favor of Perl. Is there any reason to reconsider
| nowadays?
| BoingBoomTschak wrote:
| Looks like this post I made can serve again: https://world-
| playground-deceit.net/blog/2024/10/why-tcl.htm...
|
| But to be honest, while I feel like Perl has a lot of
| advantages (full perlre, full access to POSIX APIs, slightly
| better performance), I still can't look at it and keep my last
| meal down. Tcl having an event loop and Tk being native are
| pretty nice too.
| nmoroze wrote:
| You mention Tcl's lack of language server support - just a
| shameless plug for my own project that's working on fixing
| this: https://github.com/nmoroze/tclint/blob/main/docs/lsp.md
|
| It's not quite "complete" with respect to all the usual LSP
| features (just does linting and formatting for now), but it's
| a starting point!
| AceJohnny2 wrote:
| TCL is embeddable (in another program). In fact that's how it
| started.
|
| That means it's a good language to extend your program. I don't
| know how it compares to Lua, which seems to have replaced it in
| that space.
| einpoklum wrote:
| You mean, the interpreter is available as a library with
| bindings in many languages?
|
| But then - isn't that the case for other scripting languages
| these days? Or are they too complex and with "strings
| attached"?
| robinsonb5 wrote:
| I can't speak for other scripting languages, but it's
| absurdly easy both to embed Tcl as an interpreter in a
| larger project, and to create a Tcl extension which
| implements your own commands.
| edoceo wrote:
| One can leverage Lua in PHP, I think it's handy for user-
| supplied logic (eg: business rules)
| wduquette wrote:
| I like TCL a lot more for this use case, and I don't care for
| Lua at all; but Lua might be a better match for embedding in
| an OO language.
| williadc wrote:
| Tcl is more-or-less required if you're involved with the
| physical design of silicon (most EDA tools only provide a Tcl
| interface). It's a good fit for that purpose. If you need a
| language which is easy to embed and you want non-programmers to
| be able to use it, Tcl is a good choice, though I've heard that
| Lua has supplanted Tcl for that purpose.
| everylittlebit wrote:
| In the silicon industry it's definitely tcl only. Zero Lua.
| But every tcl script I have seen is extremely simple, often
| just a bunch of commands to the EDA tool that reads like a
| list of bash commands.
| AshamedCaptain wrote:
| I'd say python starts to make some strides, likely due to
| the AI hype train. But it's still mostly Tcl.
| wduquette wrote:
| I dropped Perl for TCL decades ago, after I realized that I
| could read and understand my TCL code months after I'd written
| it, but my Perl code was totally opaque.
| forinti wrote:
| I like both Perl and TCL. If I need an executable for Windows,
| I choose TCL, because I can easily make one with freewrap.
| watersb wrote:
| The once-ubiquitous open-source package manager for macOS,
| MacPorts, is basically a Tcl app.
|
| That is to say, its packages are Tcl.
|
| I haven't used it in many years, as is has been largely replaced
| by Homebrew, which uses Ruby.
|
| (I once maintained a MacOS port of a good-sized scientific
| analysis package. Hundreds of MacPorts packages, I have
| debugged.)
|
| https://www.macports.org/
| marxisttemp wrote:
| MacPorts has far more packages than Homebrew and was
| implemented by the creator of the original FreeBSD ports
| system, who was also an employee on Apple's UNIX team. MacPorts
| is the standard macOS package manager.
| antirez wrote:
| If you want to play with reading/recreating a very small Tcl
| interpreter, recently I put Picol (a 500 lines of C code Tcl
| interpreter) on Github. It was still on the web, but a bit more
| "hidden". I had a chance to re-read the code, and it is not in
| the category of code I regret writing :D Still relatively useful
| for newcomers, I hope.
|
| https://github.com/antirez/picol
| WillAdams wrote:
| Wait, didn't Tcl/TK 9 just launch?
|
| https://www.tcl-lang.com/software/tcltk/9.0.html
|
| Any word on a nice binary release of it?
___________________________________________________________________
(page generated 2025-03-16 23:00 UTC)