3 ms·
I’ve always loved Tcl because of its absolute purity and simplicity at the language level. I love how you can implement your own control flow operators that loo
by Animats 5y ago
I’ve always loved Tcl because of its absolute purity and simplicity at the language level. I love how you can implement your own control flow operators that look like built-in ones.
Have you ever had to debug code written by someone who implemented their own control flow operators? Not fun. I've seen it done with C macros. Don't do that.
- RHSeeger 5y agoThere is a world of difference between writing a control structure in C using macros... and Tcl. And even more so when you look at a proper Lisp. Being able to construct new control structures is amazing; I miss it when in other languages.
- arthurcolle 5y agoThat sounds hilarious though
- anyfoo 5y agoA poor choice in C indeed, but languages like Haskell or (it seems, don't know much about it myself) TCL are practically made for it. Debugging "own control flow operators" is nothing very special there, mostly because control flow operators themselves aren't very special in those languages. From another way to look at it, nobody seems to bat an eye when using things like items.forEach() in, say, Node.js, even if this sort of thing is arguably much uglier to do in JavaScript vs. a "first class" functional language where common control flow operators are often just plain functions themselves.
- rectang 5y agoDynamic scoping (`local $foo`) is nothing special in Perl. It's also a construct which, like novel flow control operators, by its nature leads to code which is complicated to reason about and difficult to debug. There are many programming language concepts which may be innovative and beautiful, but whose popularity wanes because of practical flaws. (EIAS is another.)
- fiddlerwoaroof 5y agoDynamic scoping, combined with variable naming conventions, is a beautiful way to achieve “dependency injection” with a minimal amount of complexity. Like any feature, it can be abused, but it can be very elegant.
- johnisgood 5y agoI re-implemented the wheel in Forth, too, before! :)