3 ms·
Umm, sorry, no. First of all, lisp sexps have nothing to do with strings (which is why noone says that), whereas in tcl, every data structure has something to
by isr 6y ago
Umm, sorry, no.
First of all, lisp sexps have nothing to do with strings (which is why noone says that), whereas in tcl, every data structure has something to do with strings.
In tcl, semantically, everything is a string. Yes, the native internal representations of compound structures like lists and dicts are actually very efficient, but you can refer to those structures as if they were a string at any point.
And that will often cause the internal representation to switch to a string, and dump the more efficient "native" rep aside.
And that can happen when you don't really intend for it to happen (the infamouse "shimmering" problem).
Thats the biggest flaw I've found in years of hacking with tcl. It makes it hard to write funcs which take polymorphic data types. Is this a list of lists (where each sublist contains strings) or a list of strings (where each string may have whitespace)
You end up creating your own dynamic typing system sometimes. I know I have, and so have others (see the wiki).
There is SO much to love about tcl. It really is a lisp smashed into shell. And its so dynamic that you can do really powerful things in it.
Its really a lisp,, where the standard data structure is the string, not a linked list. And any func can be an f-expr (basically, sort of a runtime macro, which older lisps used to have).
I had a lot of fun redoing things like quasiquote (from lisp) in tcl. Yes, you really can generate tcl code as a template rather than manipulating strings.
Combine some sort of diy tagging system with ensembles (so that your code will run specialised funcs all automatically chosen based on your initial tag name).
The OO system is basically a toolbox for building any kind of OO system you want on top of it (almost akin to CLOS-inspired systems, in that regard)
Stackable io channels so that you can build a virtual filesystem with a various features all composed together (FUSE-like done beautifully, from a scripting lang perspective)
Great stuff. It really is a lisp/shell kind of thing, but sometimes its so dynamic that it shoots itself in the foot (shimmering, etc).
I wish they had decided to dump backwards compatibility post 8.0, and tried addressing some of horrible warts in the language and runtime, eg:
- the syntax rules are simple, but result in non-trivial code looking F UGLY (emphasis on the F). A couple of extensions to that syntax would have made the world of difference. How much more complicated would, say, 15 syntax rules be instead of 12?
- shimmering. NO. Stop it.
- not everything makes sense as a string rep (filehandles?)
- the standard commandset (really each is a DSL in its own right) needed to be revised long ago so that they were more consistent with each other (contrast list cmds with others)
Basically, maintaining backwards compatibility has killed tcl, even though it has so many nice features and potential greatness hidden inside.
(eg: jimtcl, a hidden gem)
Ok, I'm ranting now, I'll stop :-)