[HN Gopher] Closures in Tcl
___________________________________________________________________
Closures in Tcl
Author : andsoitis
Score : 71 points
Date : 2025-05-03 13:08 UTC (9 hours ago)
(HTM) web link (world-playground-deceit.net)
(TXT) w3m dump (world-playground-deceit.net)
| dingnuts wrote:
| Is Tcl having a revival? Anybody know where Tclers hang out
| online?
| 7thaccount wrote:
| They did have a recent language update after awhile. That may
| have triggered some folks to look into it again. There is
| sometimes a HN effect where an initial post triggers some
| interest amongst enough users to get us new posts for a few
| weeks and then things tend to die off again. I've seen this
| with a lot of the more obscure languages like APL.
|
| It would be cool to have a Tcl revival though (although I don't
| see it happening - I'm not in the community though so hopefully
| someone more informed can post). The language itself seems more
| capable than most give it credit for. I'm more of a Python fan
| myself, but can appreciate Tcl after reading through a book on
| it and writing a few scripts.
| bandoti wrote:
| I highly recommend The Tcl Programming Language: A
| Comprehensive Guide:
|
| https://www.magicsplat.com/ttpl/index.html
|
| For those who are not aware, Tcl is actually part of standard
| Python distribution through TKinter.
|
| There are many things Tcl has built in that are quite
| amazing, like a robust virtual filesystem support, reflective
| channels, and less known these days Starpacks (stand alone
| runtime) that bundle sources with the binary.
|
| I am current working on bringing back kitcreator for an AI
| project that uses Tcl as a scripting environment over
| llama.cpp.
|
| https://github.com/tclmonster/kitcreator
|
| Roy Keene is the original author, and has done some really
| clever stuff here, like encrypting the VFS appended to the
| executable. I added compression to this. It provides some
| manner of obfuscating sources.
|
| And actually, I am also working on using tohil to compile a
| static Python and load it as a Tcl extension, with the goal
| to have standalone Python applications bundled with their
| sources and completely loadable from within the VFS. This
| will provide a means to bundle TKinter with a "frozen" Python
| app.
|
| https://github.com/tclmonster/tohil
| 7thaccount wrote:
| The previous edition of that book is the one I read lol. A
| great book. You can really feel the author's love of the
| language.
| mhd wrote:
| The Wiki[1] is one of the primary "hang out" spots, although
| it's a bit different from usual online communication. But
| there's a lot of mutual commenting, small articles and
| utilities etc. on there.
|
| [1]: https://wiki.tcl-lang.org or https://wiki.tcl.tk
| ofrzeta wrote:
| "The European OpenACS and TCL/Tk conference will be in
| Bologna/Italy/Europe on July 10 & 11 2025." - this is crazy.
| Seems there are still people using OpenACS in 2025.
| msephton wrote:
| I last got help on the IRC channel (bridged to Slack, because I
| don't know IRC).
|
| In the most recent big version update there was what I'd
| consider a breaking change regarding text encoding handling,
| but it was possible to go back to the old behaviour with an
| additional parameter .
| monetus wrote:
| r/TCL is worth a mention
| pjmlp wrote:
| I worked on a startup whose main language was Tcl, between 1999
| and 2002, since then I hardly touched Tcl again.
|
| Yet it has a special place on my heart and was one of the
| interpreters easiest to extend, in regards to the FFI API.
| f1shy wrote:
| If you work with VHDL or Verilog tools, it is very well alive
| and kicking. Forums about HDLs are full of it.
| IshKebab wrote:
| It is unfortunately entrenched in the EDA industry. I have
| absolutely no idea why you would use it if you don't work in
| that space.
| sokoloff wrote:
| Because it works.
|
| I introduced it into some of our release tooling in the
| mid-2000s. Easy to integrate, easy to understand,
| unsurprisingly good string/text handling, expect was very
| useful, and it's not going to be used by anyone else, so no
| worries about version conflicts.
|
| It ran successfully largely unchanged for around a decade.
| IshKebab wrote:
| Everything _works_. PHP _works_. Perl _works_. Bash
| _works_.
|
| I like to use tools that more than merely _work_.
|
| There's a reason nobody outside EDA uses it.
| dlachausse wrote:
| It's included with Python in the form of Tkinter, the
| MacPorts package manager is written in it, and it's also
| used by Cisco IOS for scripting.
| johnnyjeans wrote:
| it's a language that's trivial to implement because it's well
| designed and simple, it embeds very nicely, and it's
| fantastic for use as a debug shell and to implement guis.
| it's a great technician's language, if you work with
| technically-minded people who aren't necessarily programmers,
| it's a great way to hand them deep interactive power without
| the footguns of a forth.
| IshKebab wrote:
| I would say it's _cleverly_ designed. Well designed? Hmm,
| would a well designed language have such a basic flaw as
| comments that can only be used in very specific places?
| BoingBoomTschak wrote:
| I understand where they came from here: the Scheme-like
| obsession with purity (the enshrined Endekalogue, now
| Dodekalogue) didn't mesh very well with traditional
| comment.
|
| Yeah, Tcl has its design warts, but I don't think it has
| _that many_ remaining that can 't be fixed via
| metaprogramming. Even the popular Python manages to
| frustrate me with its idiotic statement/expression divide
| (they doubled down by making match() a statement...) and
| constant need to convert between generators/iterables and
| lists.
|
| Thing is that R6RS Scheme (or R7RS-large if it comes out
| one day) is basically a better Tcl if you only consider
| scripting and don't need the event loop. If Tcl had
| played its cards right, it'd have competed with
| fish/rc/nushell/powershell instead, it was really ready
| to be a better shell well before any other.
|
| ------
|
| To be honest, Common Lisp is the only language I've ever
| seen get this right without compromising on said purity
| by specifying the reader (parser): https://www.lispworks.
| com/documentation/HyperSpec/Body/02_.h...
|
| Comments are then just the result of a readtable entry
| like any other, allowing this kind of voodoo:
| ; A comment (set-macro-character #\% (get-macro-
| character #\;)) % Also a comment
| johnnyjeans wrote:
| absolutely, i don't even consider that a flaw. i dont
| like EOL comments stylistically.
| thesz wrote:
| > Well, I've encountered this use case a few times in Lisp:...
| > ...where a callback is used to collect various items.
|
| This can be and is achieved by simple SQL-like query. Filter
| (flat) set of nodes by integerness and you even do not need a
| push_back.
|
| Despite that, I find article interesting. It shows that Tcl can
| truely be multiparadigm programming language.
|
| Myself, I've implemented pattern matching [1] over algebraic-
| type-like values and used that here and there.
|
| [1] https://wiki.tcl-lang.org/page/Algebraic+Types
| BoingBoomTschak wrote:
| The callback way is more generic and prevents consing when you
| don't need to store the resulting node list. You may want to
| simply print something or maybe modify the node in-place, for
| example.
| gitroom wrote:
| Pretty cool seeing folks show up about Tcl, tbh I messed with it
| ages ago and never thought people were still this into it
___________________________________________________________________
(page generated 2025-05-03 23:00 UTC)