Colin Macleod · @CGM
91 followers · 2971 posts · Server mastodon.scot

@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 magicsplat.com/ttpl/index.html

#programming #tcltk #tcl

Last updated 1 year ago

matthias · @m_b
124 followers · 390 posts · Server nerdculture.de

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

Last updated 1 year ago

matthias · @m_b
124 followers · 390 posts · Server nerdculture.de

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

Last updated 1 year ago

Alecu Ștefan-Iulian · @alecui
0 followers · 1 posts · Server fosstodon.org

I'll make this short and sweet

Hello! I am Ștefan (you can use your native language's Stephan equivalent).

I am interested in (computational) , {natural,constructed} x {languages,scripts}, contemporary history, ( ftw), compiler and programming language design, low-level programming, , , and operating systems among other things.

/ / / / / / /

#introduction #linguistics #typography #texlatex #astrology #deism #politics #pascal #tcltk #perl #lisp #ada #cpp #dotnet #linux

Last updated 1 year ago

Colin Macleod · @CGM
88 followers · 2619 posts · Server mastodon.scot

Videos of the presentations from last week's EuroTcl/OpenACS conference are now online, links are in the program at openacs.org/conf2023/info/sche
@tcl@kbin.social @tcl@lemmy.world

#programming #openacs #tcltk #tcl

Last updated 1 year ago

Colin Macleod · @CGM
90 followers · 2440 posts · Server mastodon.scot
Colin Macleod · @CGM
90 followers · 2440 posts · Server mastodon.scot

@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 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.

#tcltk #shell #programming

Last updated 1 year ago

Colin Macleod · @CGM
87 followers · 2382 posts · Server mastodon.scot

@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 tcl-lang.org/man/tcl8.6/TclCmd

#tcltk #programming

Last updated 1 year ago

Colin Macleod · @CGM
82 followers · 2319 posts · Server mastodon.scot

@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: colin-macleod.blogspot.com/202

#tcltk #tcl

Last updated 1 year ago

Alecu Ștefan-Iulian :verified: · @alecui
153 followers · 1280 posts · Server qoto.org

@nunomaduro pretty cool for a extension, huh? ;)

#tcltk

Last updated 1 year ago

Alecu Ștefan-Iulian :verified: · @alecui
136 followers · 1194 posts · Server qoto.org

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.

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 and soon to graduate CS @ UVABc. Sort of proudly living in . My native language is Romanian, fairly proficient at English, slowly learning (and ).

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), (+ and ), (+ ), , (usually , on a good day and ), , , , , , -2, ++, , , (+ ), , , , , , , , and . 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 and for fun (especially functional equations and number theory problems, sometimes calculus and geometric algebra). I am interested in , ( and ) and , contemporary (post-‘45, usually post-‘89 for me) history, history, lower-level stuff (I like to learn about how tools around me work, I’m most interested in , and ), and , + , , , , , , (especially in a worldbuilding context) and , along with other less notable interests.

I engage in relatively often irl, although I’m not inserting it in absolutely every scenario in my life. As I mentioned, I’m a and (or… um… ) (Nazis and fascists can have a merry fuck off, DNI with me). I am also a spiritual person, a (if you really want to put it that way, an agnostic, although it’s not quite true) and I find and 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

Last updated 1 year ago

Alecu Ștefan-Iulian :verified: · @alecui
114 followers · 954 posts · Server qoto.org

I am currently implementing a parser (and soon to be (fully-)functional interpreter) in .

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). The only advantage that particular approach had was that I could specialize getting values out of said tokens (NumberToken parses and stores a int/double value, StringToken obviously stores a string but with all escape characters parsed etc.) The parser (or the lexer at this stage) was... fine-ish, although I felt the burden of my own token abstraction.

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] github.com/zserge/partcl
[3] github.com/msteveb/jimtcl
[4] oldblog.antirez.com/post/picol

#tcltk #cpp

Last updated 1 year ago

Colin Macleod · @CGM
82 followers · 2319 posts · Server mastodon.scot

@alecui Don't know if you're aware, but , 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 wiki.tcl-lang.org/page/redis and gist.github.com/antirez/6ca04d

#tcltk #tcl #redis

Last updated 1 year ago

Alecu Ștefan-Iulian :verified: · @alecui
105 followers · 791 posts · Server qoto.org

Every day I get more and more fascinated about and its simplicity, it was the sort of language I was looking for without knowing.

While searching for libsqlite3, I noticed that has sqlite3-tcl, so that made me curious, but then I remembered 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)

#tcltk #opensuse #sqlite

Last updated 1 year ago

Alecu Ștefan-Iulian :verified: · @alecui
99 followers · 754 posts · Server qoto.org
Alecu Ștefan-Iulian :verified: · @alecui
99 followers · 754 posts · Server qoto.org
Alecu Ștefan-Iulian :verified: · @alecui
98 followers · 728 posts · Server qoto.org

Number four: . 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:

  1. 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).

  2. “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.

  3. “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.

  4. “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.

  5. “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 syntax for example).

Besides that, there are a couple of other nice things about Tcl:

  • you can have multiple paradigms: since the language is so flexible, you can add , programming, even throw some arrays for good measure (I have seen a code snippet somewhere in the Tcler’s wiki of someone doing vector arithmetic using just raw Tcl and some elbow grease).
  • because code in Tcl is first class, it’s very simple to write functional language primitives that play well with the logic of the language (for examplem with stock Tcl you can do lmap i {1 2 3 4 5} { expr $i*$i} which prints 1 4 9 16 25.
  • the Tcl source code is (in my humble opinion) one of the best written C programs you’ll find (please, look at it for yourself), the quality of the interpreter is amazing. It works exactly the same in different environment, including Tk).
  • in a way, considering how it’s written, you can kinda think about it as an accessible Lisp with square brackets (it essentially works on the same sort of notation without the s-expr part).
  • easy shelling? check. easily embeddable? check. easy sandboxable? check. reasonably rich standard library - check. high level abstractions - check. you can find all of these and more in Tcl. ;)
  • Erlang’s author said in a tweet (web.archive.org/web/2019032511):
    “You know - TCL/TK8.6 is insanely great.

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 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 , , , , , … Even . 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

Last updated 1 year ago

Colin Macleod · @CGM
82 followers · 2319 posts · Server mastodon.scot

@alecui There's a summary of Tcl Forums at tcl-lang.org/community/ .

On usenet, comp.lang.tcl is still active, though comp.lang.tcl.announce is long dead. There is wiki.tcl-lang.org/ , also old.reddit.com/r/Tcl/ but that's fairly quiet. Questions at stackoverflow.com/questions/ta 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.

#tcltk #tcl

Last updated 1 year ago

Colin Macleod · @CGM
82 followers · 2319 posts · Server mastodon.scot

@alecui I'm a Tcler who hangs out here. These days the definitive Tcl book is APN's massive tome: magicsplat.com/ttpl/index.html (doesn't cover Tk though).

By the way, the hashtag sometimes gets confused with either the Chinese electronics manufacturer or a French public transport company, so I tend to use to avoid any ambiguity.

#tcltk #tcl

Last updated 1 year ago

Colin Macleod · @CGM
82 followers · 2319 posts · Server mastodon.scot

@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 - wiki.tcl-lang.org/page/Diskusa

For contrast, a fairly comprehensive program I wrote for designing Scottish tartans - chiselapp.com/user/cmacleod/re

#programming #tcltk #tcl

Last updated 1 year ago