4 ms·
I recently started learning Tcl for the heck of it and am surprised by what a nice little language it is and that it doesn't get more publicity. It's true that
by Fwirt 6y ago
I recently started learning Tcl for the heck of it and am surprised by what a nice little language it is and that it doesn't get more publicity. It's true that it's not great for working with numbers or complex data structures, but it's a really nice language for "plumbing", and is still in active development. The last few releases have added support for tail-call recursion, "coroutines", and native dictionaries. It's had a bytecode compiler for like 20 years, so it's not as slow as it used to be.
As far as complaints about the syntax being weird: It's far more consistent than Algol descendants in that everything is a string, much like everything in Lisp is a list. You don't have to learn a bunch of different syntactic constructs, everything is a string, and every string is a space-delimited list, and can be interpreted as a command. The hardest part of the language is the quoting rules, which the documentation affectionately refers to as "quoting hell". Once you wrap your head around that, everything becomes clear. The standard library is pretty easy to learn, and the documentation is good.
Check it out.
- agumonkey 6y agoAlso the community is quirky fun, I remember finding a lot of esoteric implementation of whatever cs/lisp concept I could think of. These kind of communities are fun.
- sigzero 6y agoThe core developers are very thoughtful bunch on what gets into Tcl as well. It's nice to watch the back and forth traffic.
- mucholove 6y agoTCL (pronounced Tickl, if you’re still still saying T-C-L) is one of my absolute faves. Using TK from the command line is so easy / fast. And...as a language, it really helps to teach you important concepts. SQLite and Redis both emerge from TCL. The best place to see it in action is the SQLite codebase. Highly recommended.
- pdw 6y agoI've recently spent some time experimenting with Tcl, and I've developed some affection for it, but what tripped me up is that "everything is a string" means that Tcl is one of the few truly weakly typed languages. This Tcl notation: {a b} might represent any of the following data structures in JSON notation: "a b" ["a", "b"] [["a"], ["b"]] {"a": "b"} {"a": ["b"]} This can make reading some Tcl code quite a puzzle.
- networked 6y agoGood observation. Tcl's {a b} also represents something not possible in JSON: {["a"]: ["b"]} The string a can be treated as "a", ["a"], [["a"]], [[["a"]]], ... by list operations.
- dkfellows 6y agoTechnically, Tcl's internal type system is that all other value types are subtypes of string, universally serializable to string, and will correctly round-trip through string. But it also means that you can type-pun stuff if you want; it just costs time. FWIW, the best handling I know of JSON in Tcl is the rl_json package (https://github.com/RubyLane/rl_json https://github.com/RubyLane/rl_json) which essentially makes JSON into what works like a native Tcl value type.