6 ms·
Tcl Tutorial
- hiAndrewQuinn 2y agoI 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 2y agoI tought expect is a test framework
- AceJohnny2 2y agoExpect 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 2y agoSQLite 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 2y agoExpect is an automation framework. Automating tests is just one use for it.
- aerostable_slug 2y agoI 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."
- deleted 2y ago[deleted]
- liveoneggs 2y agoI thought with the rise of chatbots tcl/expect would see a big resurgence. It's definitely been on my to-do list in the last few months.
- zerr 2y agoI skipped Tcl in favor of Perl. Is there any reason to reconsider nowadays?
- BoingBoomTschak 2y agoLooks like this post I made can serve again: https://world-playground-deceit.net/blog/2024/10/why-tcl.html 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 2y agoYou 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 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!
- doublerabbit 2y agoI don't use language servers myself personally but wanted to give you a kudos for attempting something.
- BoingBoomTschak 2y agoWell, thank you and good luck!
- AceJohnny2 2y agoTCL 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.
- 2y ago
- deleted 2y ago[deleted]
- watersb 2y agoThe 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/ https://www.macports.org/
- marxisttemp 2y agoMacPorts 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.
- michaelsbradley 2y agoWhat do you mean by “standard”? I like MacPorts, but most macOS using developers I’ve conversed with over the past 12+ years never heard of it, while all of them used Homebrew. Maybe it depends on what developer circles one inhabits.
- mikrl 2y agoI have only ever used macports, but my first and only MacBook was salvaged from bigcorp IT, and is a 2009 model so homebrew is too new for it. I’ve dabbled in BSD before and I can definitely see the correspondence between Macports and freeBSD ports. I assume homebrew tries to be more similar to apt or yum.
- michaelsbradley 2y agoYes, one of several nice things about MacPorts is the continued support for older macs, macOS/OSX versions.
- wpm 2y agoMacPorts is a godsend on older Macs. Takes forever to compile stuff on a G3 though :)
- antirez 2y agoIf 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 https://github.com/antirez/picol
- analog31 2y agoThanks for that effort. Some time ago, I got Picol working on an Arduino-compatible microcontroller board with minimal effort. I was working towards making my own programmable calculator, and test-drove a number of simple interpreters, including yours and a couple others. Project languished due to my attention span running out, but I still have my adaptations of those codes on my drive, in case I ever pick it up again.
- somekyle2 2y agoThanks for Picol! I saw it as a young engineer, and found the simplicity inspiring. It inspired me to write Tcl interpreters as starter projects in the next languages I was picking up, and I learned a lot by trying to push performance , functionality, and correctness. Your little project ended up inspiring cumulative months of joyful hacking.
- bulletmarker 2y agoI wonder how this relates to Jim Tcl which you also originally authored?
- WillAdams 2y agoWait, didn't Tcl/TK 9 just launch? https://www.tcl-lang.com/software/tcltk/9.0.html https://www.tcl-lang.com/software/tcltk/9.0.html Any word on a nice binary release of it?
- kristopolous 2y agoit's worth noting for those unfamiliar, tcl/tk 8.0 came out in 1997. So this isn't a normal thing, this is a 27 years in the making kind of thing.
- WillAdams 2y agoYeah, I just wish there was a nice/supported/reasonably capable GUI designer.... (and I'd love to be directed to one, having been unsuccessful in searching for one).
- ofalkaed 2y agoThere are quite a few half finished GUI designers for it but I suspect they all remain half finished because the people who start in on them realize that such a tool will not get Tcl/Tk onto the level of QT or GTK and fights against what makes Tcl/Tk such a great tool. It is not about slick and highly refined UIs, it is about quickly and easily making functional UIs. You learn the sense and quirks of pack and grid and for applications which those simple containers work well for, nothing will be as fast or as easy as Tcl/Tk despite the lack of a GUI designer. Tcl/Tk is not for big complex UIs, it can do them but generally you will be better served by other toolkits for those. tkcon gets you reasonably close to a GUI designer, it is text mode but instantaneous, and quite simple to configure the widgets to allow you to configure them with your mouse if you really want to do that. https://github.com/wjoye/tkcon https://github.com/wjoye/tkcon
- WillAdams 2y agoThank you for that link, and that observation. I am probably going to have to break down and learn/work with QT or something similar for the graphical project I am planning out and have been searching for an environment for.
- kras143 2y agoTcl offers a unique combination of embeddability and power, often underappreciated outside specific domains. While its general-purpose usage might be less prominent, its dominance in Electronic Design Automation (EDA) is undeniable.
- ChipsNDip 2y agoNice, a TCL post! I use TCL often (forced to) since it's Cloverleaf Integration Engine's official scripting language and it works very well, but it is different from other languages in that its syntax is not modern, though, it's not difficult to learn if you really need to. It's an older language that's fallen out of favor mostly for other scripting languages (Javascript, Python, etc) and understandably so. I'm by no means an TCL, but do consider myself an expert when using it with Cloverleaf. Thanks!
- twothamendment 2y agoI haven't used TCL in a few decades and I don't miss it, but that is likely due to running it on storyserver. Worst web platform ever.
- hieloz 2y agoNice. Tcl scripts are widely used in wireless communication,especially base station testing.
- ksynwa 2y agoThe syntax looks similar to that of fish shell
- uwagar 2y agoTcl is such fun. except for using expr to do math. i mean in other languages a + b in Tcl its expr $a + $b thats my only beef.
- sureglymop 2y agoCool! What I would recommend right off the bat is installing the handy tool `rlwrap` and starting `tclsh` using the command `rlwrap tclsh`. This wraps it with readline which imo is a better experience (especially if one is used to the readline keyboard shortcuts).
- neotek 2y agoSo many fond memories of building eggdrop bots with Tcl scripts in the good old days of IRC. Trivia games, quote dbs, channel management, nick squatting, all sorts of shit.
- deleted 2y ago[deleted]