[NTLUG:Discuss] 30 minutes to Tcl as a scripting language presentation
David Good
david.good1 at gmail.com
Thu Apr 10 23:16:58 PDT 2025
I've been thinking about this and have come up with three things :
1 . Since the language is conceptually all strings , it is very easy to
write code that writes code . You can write functions or simple loops who
create specific function calls or UI buttons with their respective
callbacks or whatever else you want . The language is naturally a
templating language , and once you start to think that way , other
languages will seem somewhat frustrating .
2 . The event loop is so simple and well built that creating a single
threaded , non-blocking application is very easy to reason about and will
have very good performance . There are basically only two event types
(channel i/o and timers) , and everything else can be built off of those :
3 . Single file executables . These are called starkits , and come in two
flavors : a platform specific executable or a platform independent .kit
file . These make it super-easy to develop an application (or a script) and
pass it around without having to worry if your target user has a TCL
interpreter or even knows what TCL is .
4 (Bonus) . You can run TCL scripts unmodified from any python interpreter
in a pinch ! Python Tkinter just binds TCL/Tk for making GUIs in Python ,
but the whole interpreter is there for you to use as you see fit .
import tkinter as tk
tcl = tk.Tcl()
tcl.eval('source myfile.tcl') # or whatever command you want to run here
--David
On Fri, Apr 4, 2025 at 6:35 PM Steve Litt <slitt at troubleshooters.com> wrote:
> David Good said on Wed, 2 Apr 2025 22:05:55 -0500
>
> >I'm a huge TCL/TK fan . I use it all the time , for desktop
> >applications as well as "scripting" applications (open this file ,
> >edit such and such , copy files to the server , etc) .
>
> Cool! Could you please tell us what I left out of the following Tcl
> philosophy document:
>
> https://troubleshooters.com/codecorn/tcl/philosophy.htm
>
> Also, Tcl is a very different kind of language from C, Python, Lua,
> Ruby, Perl, or Java. Could you please let us know the mindset you adopt
> when programming in Tcl?
>
> Thanks,
>
> SteveT
>
> Steve Litt
>
> http://444domains.com
>
>
> _______________________________________________
> http://www.ntlug.org/mailman/listinfo/discuss
>
More information about the Discuss
mailing list