@rossm You're not living in the past, you're appreciating the classics!
TBH the Welch/Jones Tcl book is a bit dated now, a more current alternative would be https://www.magicsplat.com/ttpl/index.html
#tcl #tcltk #programming
Erste Programmskizze für Daumenkino-Druck aus Video in PDF für die Kids beim nächsten Trickfilm-Workshop.
Läuft, wird noch schicker hoffentlich. :)
#tcltk #ffmpeg #imagemagick
Erste Programmskizze für eine Daumenkino-Montage aus Video in PDF. Muss bis zum nächsten Workshop auf Linuxrechnern für die Teamer:innen grafisch ausführbar sein.
#tcltk #ffmpeg #imagemagick
I'll make this #introduction short and sweet
Hello! I am Ștefan (you can use your native language's Stephan equivalent).
I am interested in (computational) #linguistics, {natural,constructed} x {languages,scripts}, contemporary history, #typography (#texlatex ftw), compiler and programming language design, low-level programming, #astrology, #deism, #politics and operating systems among other things.
#pascal / #tcltk / #perl / #lisp / #ada / #cpp / #dotnet / #linux
#introduction #linguistics #typography #texlatex #astrology #deism #politics #pascal #tcltk #perl #lisp #ada #cpp #dotnet #linux
Videos of the presentations from last week's EuroTcl/OpenACS conference are now online, links are in the program at https://openacs.org/conf2023/info/schedule
#tcl #tcltk #openacs #programming @tcl@kbin.social @tcl@lemmy.world
#programming #openacs #tcltk #tcl
OpenACS/TCL/Tk conference sessions online now:
Program:
https://openacs.org/conf2023/info/schedule
Time zone: CEST
Link for day 1:
https://learn.wu.ac.at/eurotcl2023/lecturecasts/690689437
Link for day 2:
https://learn.wu.ac.at/eurotcl2023/lecturecasts/690689477
#tcl #tcltk #openacs @tcl@kbin.social @tcl@lemmy.world #programming
#programming #openacs #tcltk #tcl
@Sempf "When will I learn to pipe the results of tools to a file?" - been there, done that! So when I wrote my own shell/terminal https://wiki.tcl-lang.org/page/gush I included features for:
- unlimited scrollback and search within output of previous commands;
- making the output of the last command available as variable $_ , and stdout/stderr of previous command number n as $out(n) and $err(n) so these can be fed in to subsequent commands without having to regenerate them.
#programming #shell #tcltk
@jakub_neruda You can get quite close to this in Tcl, but in prefix form:
(Tcl) 19 % namespace path ::tcl::mathop
(Tcl) 23 % if {[< a b c]} {puts yes} else {puts no}
yes
(Tcl) 24 % if {[< a d c]} {puts yes} else {puts no}
no
See documentation at https://www.tcl-lang.org/man/tcl8.6/TclCmd/mathop.htm#M18
#programming #tcltk
@alecui @silasmariner Note that this is even more purist than Lisp, where there are "special forms" which create different contexts for their arguments.
I described Tcl's approach as "radical minimalism" in something I wrote a while back: https://colin-macleod.blogspot.com/2020/10/why-im-tcl-ish.html
#tcl #tcltk
I have quite a lot more followers than I did when I first wrote my introduction, so it’s only fair that I’m writing a new one, bump up the major version.
#introduction #intro #introductions
Hi! o/
I am Ștefan (ș as sh, I also accept Stephan or the equivalent in your language). I’m 21 years old, ♑, he/him, proud #leftist and soon to graduate CS @ UVABc. Sort of proudly living in #romania. My native language is Romanian, fairly proficient at English, slowly learning #finnish (and #italian).
Tried a lot of programming languages in my childhood up until now, a non-chronological list of ones that stuck with me for one reason or another being: VB6 (that’s what I started on at 8 years old), #pascal (+ #freepascal and #delphi), #perl (+ #raku), #tcl #tcltk, #lisp (usually #scheme, on a good day #elisp #emacslisp and #commonlisp), #elixir, #php, #forth, #lua, #oberon, #modula-2, #cpp #c++, #ocaml, #fsharp, #smalltalk (+ #squeak #pharo #self), #ada, #powershell, #dart, #matlab, #rlang, #zig, #nim, #cobol and #julia. I don’t claim full proficiency in all of these, but I’m familiar enough with these (+ some others not mentioned here) that I could get along just fine with 2 weeks at most of studying and looking through cookbooks and examples). I’m flexible in learning new languages and technologies if needed.
I also do #sudoku and #math for fun (especially functional equations and number theory problems, sometimes calculus and geometric algebra). I am interested in #linguists, #conlangs (#lojban and #esperanto) and #nlp, contemporary (post-‘45, usually post-‘89 for me) history, #balkan history, lower-level stuff (I like to learn about how tools around me work, I’m most interested in #compilers, #emulators and #microcontrollers), #typography and #latex, #linux + #bsd, #msdos, #amiga, #oberon, #plan9, #philosophy, #astronomy (especially in a worldbuilding context) and #philosophy, along with other less notable interests.
I engage in #politics relatively often irl, although I’m not inserting it in absolutely every scenario in my life. As I mentioned, I’m a #leftist and #progressive (or… um… #woke) (Nazis and fascists can have a merry fuck off, DNI with me). I am also a spiritual person, a #deist (if you really want to put it that way, an agnostic, although it’s not quite true) and I find #astrology and #tarot interesting (I’ll let you guess my moon and ascendant, let’s see how close you are).
With that being said, I hope I’m welcome here, you can pick your subset of things that interest you from this list, you have plenty of options. :P Quite a bit longer than last time, but oh well…
#introduction #intro #introductions #leftist #romania #finnish #italian #pascal #delphi #tcltk #elisp #freepascal #perl #elixir #php #forth #modula #fsharp #smalltalk #squeak #pharo #self #amiga #plan9 #philosophy #astronomy #politics #progressive #woke #tarot #tcl #lisp #scheme #raku #emacslisp #commonlisp #lua #oberon #cpp #c #ocaml #ada #powershell #dart #matlab #rlang #zig #nim #cobol #julia #sudoku #math #linguists #conlangs #lojban #esperanto #nlp #balkan #compilers #emulators #microcontrollers #typography #latex #linux #bsd #msdos #deist #astrology
I am currently implementing a #tcltk parser (and soon to be (fully-)functional interpreter) in #cpp.
The Token class was… quite an adventure. First I actually did CRTP and I stored the tokens in a std::vector<std::unique_ptr<TokenBase>>>
. Boy was it a shitshow. It wasn’t scalable at all (NumberToken, StringToken, NewlineToken, VariableToken etc. all derived from Token
Then I scrapped that and went with a more conventional approach, it went a bit better (as in no CRTP, although in retrospective I could’ve probably used concepts…). I even wrote macros specifically so I can use a different format in std::format in operator«, relatively scalable since I don’t have many format types to begin with. The lexer was a bit weird to write.
This is the moment when I got up at 3 AM, looked at myself in the mirror and told myself: “what the fuck are you doing?”. Now I just deleted the code, I am DTSTTCPW [1], so I am doing it all in one header/source pair. I’ll refactor later, I need to get something done quick. Not like I’ll care about this specific implementation after I’m done with my bachelor’s thesis, having TDD is already light years ahead of my competition.
I had that realization because I looked at projects like ParTcl[2], JimTcl[3] and picol[4] and I said: “these are made in C and all under 1k lines, no OO in sight). If they could do it in such few lines of code, I can do it too within maybe 2K LOC total (at most, I don’t even need to support all of Tcl, it’s a minilanguage for the purposes of my thesis, it has to be Turing complete :P).
Moral of the story: sometimes OO clouds your vision and traps you in your own abstractions if you’re not careful.
[1] = Do(ing) the simplest thing that could possibly work.
[2] https://github.com/zserge/partcl
[3] https://github.com/msteveb/jimtcl
[4] http://oldblog.antirez.com/post/picol.html
@alecui Don't know if you're aware, but #redis, one of the best-known no-sql database systems, started life as a Tcl prototype before being rewritten in C. The Redis command structure still looks very similar to Tcl.
See https://wiki.tcl-lang.org/page/redis and https://gist.github.com/antirez/6ca04dd191bdb82aad9fb241013e88a8
#tcl #tcltk
Every day I get more and more fascinated about #tcltk and its simplicity, it was the sort of language I was looking for without knowing.
While searching for libsqlite3, I noticed that #openSUSE has sqlite3-tcl, so that made me curious, but then I remembered #sqlite began as a Tcl extension (that’s the reason SQLite has a feather in its logo). There’s something about this combination that fits… so well.
For example, this is how you can all table names from a SQLite database: set tableNames [db eval {SELECT tbl_name FROM sqlite_master}]
(after you do sqlite3 db example.db
).
(yes, you can just do strings like that like it’s nobody’s business, no fancy schmancy string interpolation). I find it satisfying to straight up write SQL uninterrupted.
Another example: db eval {CREATE TABLE t1(a TEXT, b INTEGER)}
, then you can do db eval {SELECT a FROM t1} { puts a=$a}
and it will print out the first column, exactly as you’d expect.
You can also naturally extend SQLite using Tcl. Let’s take a trivial example: a square root function. It might look something like this: proc sql_sqrt {v} {return [expr {sqrt($x)}]
, then you register it using db function sqrt sql_sqrt
. Once that’s defined, you can use it wherever any of the built-in SQL functions are allowed: db eval {CREATE TABLE t2 AS SELECT sqrt(b) FROM t1}
or db eval {SELECT x FROM t3 WHERE sqrt(a*a+b*b)>10}
. The beauty of this is that the procedures can be arbitrarily complex and can even take advantage of the metaprogramming Tcl offers using uplevel
, upvar
and eval
. For example, if you need a function that executes arbitrary Tcl code supplied as its argument, you can do something like proc sql_eval {code} {uplevel #0 $code}
and then db function eval sql_eval
, thus giving you the ability to evaluate Tcl from within SQL (ain’t that cool?)
I severely underestimated Tcl and you, the reader, probably have too, so come and give it a try, join the dark side, we have cookies, milk and a good Emacs mode (I think vim’s mode is also good fwiw)
Number four: #tcl #tcltk. Not as much hate as Perl gets, but a lot of misconceptions that I want to clear up for people who might hear about this for the first time:
Tcl != Tk. Although they’re released together nowadays, Tk is a standalone cross-platform widget toolkit. That’s where the Tk in Tkinter comes from. There are several bindings for Tk: Ada (TASH), Python (the aforementioned Tkinter), Perl (Tcl::Tk, Tkx and Perl/Tk if you want native Perl access to Tk structures), Lua (tclua and ltcltk), Haskell (HTk), Ruby, Scheme, Ksh (through dtksh), R (tcltk) and probably many others. The Python bindings even use Tcl as a bridge to Tk, same with Tcl::Tk and Tkx from Perl).
“Tk looks bad”. While it used to look like Motif on Unices, now it has (for quite some time) a native look and feel + theming support. Tkinter people sure don’t complain and probably neither do you realistically speaking.
“Tcl is a toy language”. On the contrary, it’s really powerful with the syntax it has (that and its syntax is defined by the Dekalogue, only 12 rules). In a way, it’s like Lisp and Forth (two of my crushes). I even tried a Forth-esque DSL in Tcl… and I could actually do it. I can implement if I wish try/catch, for..in, exceptions, classes, I can model it to my liking. This argument is genuinely more petty than even “Lisp has too many parentheses”. Additionally, it isn’t complex, which is a good thing (you can actually understand the whole language, implementation included). You can even redefine anything in Tcl using rename
or have access to the Tcl interpreter using eval
, uplevel
and upvar
for some metaprogramming if you so wish.
“Tcl has no types”. Yes, if you want to be strict about it, it only has strings (although that’s like saying that Lisp only has lists). You don’t need to perform conversions, however you aren’t likely to introduce bugs because the checks on the format of the strings are very strict. It’s a bit like Postel’s law: “be conservative in what you send, be liberal in what you accept”, but in reverse I think. Even better, you don’t need serialization because everything is a string already. You can even do stuff like sending a list through a TCP socket through puts $socket $mylist
and on the other side set mylist [read $socket]
, it’s that easy. The central data structure is the list, not the string, and any Lisp programmers knows the implications of that.
“Tcl is slow”. This shares the same sentiment as in the Perl argument. Of course it isn’t gonna be a power house for sure in the runtime department, but it sure is quick to develop in. Heck, once you have some commands going on, you can start writing executable files that look like configuration (if you really tried, you could surely replicate #nginx syntax for example).
Besides that, there are a couple of other nice things about Tcl:
lmap i {1 2 3 4 5} { expr $i*$i}
which prints 1 4 9 16 25.I stopped using TCL/wish in about 2004 - this was a BIG
mistake - I can now build GUIs in described by pure text.
Nothing is hidden it’s all text - I just need emacs and make.
Why oh why did I ever even click on a button to start Xcode”
The only people that are mad about Tcl/Tk at this point are RMS (because he’s still butthurt that #guile failed in face of Tcl and not even Emacs adopted, only Guix (Guile is good though), he even went so far as to call John Ousterhout a “parasite” (ironic coming from him, huh?)), MAYBE Larry Wall and people who didn’t bother checking up Tk (or looking at Tcl ever). And with that (for today, I think) I am done, although I could touch up on #forth, #php, #ada, #cobol, #smalltalk, #fortran… Even #ml #prolog. These languages deserve some love too, even though they aren’t particularly used. I truly believe that Tcl should become a more popular language, for me it was love at first sight (I like it so much that this is the language I chose to implement for my bachelor’s thesis on a Raspberry Pi Pico). Long live Tcl.
#tcl #guile #php #ada #cobol #smalltalk #tcltk #nginx #oop #functionalprogramming #fp #forth #fortran #ml #prolog
@alecui There's a summary of Tcl Forums at https://www.tcl-lang.org/community/ .
On usenet, comp.lang.tcl is still active, though comp.lang.tcl.announce is long dead. There is https://wiki.tcl-lang.org/ , also https://old.reddit.com/r/Tcl/ but that's fairly quiet. Questions at https://stackoverflow.com/questions/tagged/tcl+or+expect tend to get answered quite promptly. The Tcler's Chat on jabber/irc/slack is very much alive too, but tends more towards esoteric discussions of Tcl internals.
#tcl #tcltk
@alecui I'm a Tcler who hangs out here. These days the definitive Tcl book is APN's massive tome: https://www.magicsplat.com/ttpl/index.html (doesn't cover Tk though).
By the way, the hashtag #tcl sometimes gets confused with either the Chinese electronics manufacturer or a French public transport company, so I tend to use #tcltk to avoid any ambiguity.
@yugaego A couple of Tcl/Tk examples:
Here's a simple utility I knocked up long ago to track down why your disk just filled up - https://wiki.tcl-lang.org/page/Diskusage
For contrast, a fairly comprehensive program I wrote for designing Scottish tartans - https://chiselapp.com/user/cmacleod/repository/tartaniser/home