Hacker News new | past | comments | ask | show | jobs | submit login

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…


In that sense, yes, very little magic...enabling vast conjurations. :-)

It's also absurdly easy to integrate into C or C++ projects, or to write an extension in C or C++ which can be loaded to implement new commands.

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!

Ah! Here's the set of axioms: the Tcl Dodekalogue. https://wiki.tcl-lang.org/page/Dodekalogue?R=0&O=Dodecalogue...

Brilliant. That wiki is quite something. Getting a real sense of the core of the language is within easy reach.

> The Tcl language is made up of commands

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 need to learn Tcl.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: