4 ms·
TCL 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 comman
by charlesdaniels 6y ago
TCL 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]