| ▲ | zvr 21 hours ago | |
Besides Tk and the ease of creating GUIs, Tcl has some unique advantages. As I have written before, a favorite of mine, which I have not found in other languages (besides LISP, obviously) is the ability to treat data as code combined with the existence of safe slave interpreters. This is extremely useful for configuration files: they can use some functions you have defined, but may also include arbitrary code. In order to load them, you simply fire up a safe slave interpreter to execute the code and you're done! Imagine a config file like:
This can obviously be manually parsed easily, but this is also valid Tcl code, if one has defined the functions "host", "port", and "dbhost".
And this allows people to extend the config file to something like:
Having a "full-blown programming language" for free in config files is sometimes desirable.I'm writing much more Python than Tcl these days, but this is a feature I sorely miss. I keep looking for similar functionality in Python, but I am always disappointed. Starlark has been proposed in the past, but unfortunately it means you have to work with something different than Python (in developing, in deploying, etc.), doubling your dependencies. | ||