The Tcl language is made up of commands; a command has a name and takes an argument list, with which it can do literally anything. The standard commands are written in C; Tcl `procs` are commands that are written in Tcl. The control structures, like `if` and `foreach` and `while` is just a Tcl command. The `proc` command that defines a proc is just a Tcl command.
I think of it as Lisp for C programmers.
So: is the language implemented mostly in itself? No, it's mostly implemented in C. Is there a minimal amount of magic? No; the amount of magic you can do is effectively unlimited.
> Is there a minimal amount of magic? No; the amount of magic you can do is effectively unlimited.
I might be mistaken, but I think the OP was asking if there is surprising magic (I.e. special cases/considerations) built into the language, in which case I’d say, “No, Tcl is not “magical”, but surprisingly simple and regular.” That said, indeed it’s powerful in its application of its primitives, but you do still need to mind some things (don’t pretend* you can quote better than the quoting engine, don’t pretend* you can do lists better than the list processor, …). Not magical though - very understandable.
*rules are meant to be broken, blah, blah, but the “gotchas” are new practitioners falling into this, or advanced cases, falling into this…
Thanks for this explanation. It was very helpful. In terms of magic I meant it simply as how big is the set of unchangeable axioms, as opposed to how many things are derived in the language itself from a more minimal set of magical axioms. With Lisp being the language with the least magic lisp for C programmers was insightful!
As someone that is stubbornly trying to design a Smalltalk-Forth hybrid syntax, where everything is words, nay, messages in a declarative/concatenative pipeline, without success, reading this makes me inappropriately giddy.
I think of it as Lisp for C programmers.
So: is the language implemented mostly in itself? No, it's mostly implemented in C. Is there a minimal amount of magic? No; the amount of magic you can do is effectively unlimited.