5 ms·
Data Definition and Code Generation in Tcl (2014) [pdf]
- sigzero 6y agoInteresting. I had no idea NASA used Tcl.
- non-entity 6y agoI've had people tell me in the past that TCL is used in all kinds of inconspicuous areas. This is the second time I've seen real world usage of it, the first being FPGA toolchains.
- auxym 6y agoI've heard it's used a lot in EE design software (PCB design, or FPGA as you mentioned). My experience with Tcl is as part of Altair's suite of mechanical simulation (FEA, MBD, etc) software, which is quite popular in aerospace and automotive. It has its warts (associative arrays) but it's still a neat little language. EIAS actually works pretty well as an abstraction tool. I'd take it over VB (eg, excel VBA) anyday as a macro/automation language. Good post on tcl by antirez, creator of redis: http://antirez.com/articoli/tclmisunderstood.html http://antirez.com/articoli/tclmisunderstood.html
- bloaf 6y agoYeah, I use it in chemical process simulation and I pretend arrays don't exist. Dictionaries for everything, unless my software version is old enough that the Tcl version doesn't support them.
- tyingq 6y agoAnother example is F5 load balancers. It's their embedded scripting for health checks, content transformations, etc. There's a list of other places it's used here: https://wiki.tcl-lang.org/page/Who+Uses+Tcl https://wiki.tcl-lang.org/page/Who+Uses+Tcl
- non-entity 6y agoOh wow I completely forgot about Cisco's IOS.
- HarryHirsch 6y agoSo it's not only sweetwater molecular dynamics that uses TCL but CCP4 as well. Nice! (Coot uses Scheme, though.)
- gnufx 6y agoYes, I recall Paul Emsley getting more than that right. At one time the area was continually shifting around TCL, Perl, Python, not really finishing anything off. That was mainly one person's influence for some reason.
- tyingq 6y agoI worked for HCI, which was healthcare.com, back in the day. Our entire UI and data layer, at the time, was TCL/TK. Things changed, of course, but TCL did have a lot influence in the Health Care/HL7 world...which marches on.
- neilv 6y agoTwo reasons: it was targeted as an embeddable application extension language (kinda like Python); and, thanks to Tk, it was a relatively easy way to make passable GUI interfaces on Unixes. (There was also a very brief attempt early in the Web to use Tcl for Web development, as an arguably superior alternative to then-popular things like Perl CGI, but that didn't take over.) What people should've been using for embeddable extension languages is a Scheme implementation, which, besides other merits, wasn't crippled by an evaluation model based on string expansion. I was in charge of one such extension language for a system that cost 5 figures a seat, and Tcl's string evaluation wasn't that up to representing objects and graph references well. (At the time, extension languages of major applications were often some simple/custom Lisp.) Tcl was pretty neat, in how much more clever it was about some kinds of string evaluation than Unix shells, but a Scheme would've still been a better choice.
- gnufx 6y agoTCL is fat,slow,and lacks staying power. — (SIOD author) George Carrette, 1994 At least we could direct people who wouldn't see the light towards Python at that stage.
- charlesdaniels 6y agoTCL is an often overlooked language. It has a lot of weirdness, but that's a symptom of it's age I think. I really like it as a language for interactive command-shell type use cases, as opposed to languages like Lua. It feels much closer to a shell than a programming language. If you want some kind of interactive command shell, I would very much vouch for using TCL as opposed to writing your own from scratch. There is also a lightweight/embedded variation, Jim TCL[0] if that's more your bag. It is an interesting choice for writing a parser in, but it makes a certain amount of sense. It's portable, battle-tested, and has surprisingly robust string processing facilities. I have also found it useful as a data format, but rather than writing a parser in TCL, I tend to prefer to define keywords to turn TCL into a DSL. Here is a trivial example I made up for this post: [1]. If you want to see some example code for integrating with C/Python, I have some here[2]. I had planned to give a talk on the subject but it fell through. 0 - http://jim.tcl.tk/index.html/doc/www/www/index.html http://jim.tcl.tk/index.html/doc/www/www/index.html 1 - https://rextester.com/FME19315 https://rextester.com/FME19315 2 - https://github.com/charlesdaniels/teaching-learning/tree/master/libraries/tcl/package https://github.com/charlesdaniels/teaching-learning/tree/mas...
- dfox 6y agoI would say that most of the weirdness of Tcl is not caused by age, but because at its core it is nothing else than shell without all the tradional unix shell syntactic cruft. In the end Tcl is nothing else than shell with exactly two quoting mechanisms ("" and {}) and exactly two expansions ($variable and []), everything else is built as commands on top of this simple language.
- ufo 6y agoI recently discovered that rewriting shell scripts into TCL works really well -- going from Bash to Tcl is a smoother transition than Bash to Python. The "exec" command even has support for redirections and pipes.
- deleted 6y ago[deleted]
- suyjuris 6y agoReading this really reminded me of some of the fascinating/crazy things Tcl is capable of, all based on a simple programming model focused on strings. Like, want to pass a reference to a variable? Simply pass the name of the variable to the function and then do proc f {varname} { upvar 1 $varname var set var ...somevalue... } The upvar “links” the local variable var to the variable named $varname in the scope of the calling function. Or maybe you are in dire need of a control construct that loops thrice? No problem: proc do_thrice {code} { foreach _ {1 2 3} { uplevel 1 $code } } Okay, this does not handle break, continue or error propagation (you can do that also, but it would be a bit longer). You can use this like so: set text Go! do_thrice {puts $text} The variable text is not visible inside of do_thrice; but the uplevel executes the code in the scope of its caller, so it can read and write to the local variables just like an ordinary loop. Of course, in ordinary code you should mostly avoid this kind of stuff. Though apparently uplevel is used by NASA, of all people, so I guess it is fine! More fun stuff: You use the built-in proc to define a new procedure, but you can replace it by your own, e.g. to insert profiling code at beginning and end. (Hint: If you try this, use uplevel when calling the built-in proc, to avoid namespace problems.) You can parse and rewrite code at runtime (of course) which I once used to insert “breakpoints” at runtime for my program to debug itself.
- doublerabbit 6y agoTCL is one of the few languages allowing you to dabble in to and one of the few that caught hook with me. It's friendliness then leads you down a path of voodoo and creativity. proc displayHackerNews {} { set hn "Hacker News" ;#Fill the variable (hn) with the string "Hacker News" puts $hn ;#output the variable ($hn) to terminal } ;#end procedure displayHackerNews ;#execute the procedure displays: Hacker News If statements are easy set hn "" if { $hn eq "Hacker News" } { puts $hn } else { set hn "Not Hacker News" puts $hn } ;#end if Infinite Loops are fun set hn "Hacker News" ;#Set a variable while { $hn eq "Hacker News" } { puts "$hn" ;# print "Hacker News" to terminal in an infinite loop } ;#end loop Multi-threading is a breeze. package require Thread set MyThreadID [thread::create { puts "Hello from my new thread" thread::wait } ;#end code-to-run ] ;#end thread And finally, a if-switch-threaded-loop set hn "Hacker News" if { $hn eq "Hacker News" } {set switch "hn" } else { set switch "" } switch $switch { hn { set MyThreadID [thread::create { proc displayHackerNews {} {set hn "Hacker News" ; puts $hn} ;#end procedure #set aCounter to zero, if aCounter is < 7 execute displayHackerNews procedure for {set aCounter 0} {$aCounter < 7} {incr aCounter} { displayHackerNews } thread::wait } ;#end threaded-code ] ;#end thread } ;#end switch-case default {puts "It's still not hacker news"} } ;#end switch
- deleted 6y ago[deleted]
- Twisol 6y agoI have it on good authority that this actually dates back to 2003! See the schedule of Tcl'03 [0], or the index page for this document at JPL's Technical Report Server [1] [0] https://www.tcl.tk/community/tcl2003/schedule.html https://www.tcl.tk/community/tcl2003/schedule.html [1] https://trs.jpl.nasa.gov/handle/2014/7660 https://trs.jpl.nasa.gov/handle/2014/7660