2 ms·
I mean, if it's just Python code as config for a Python, couldn't you just write your config in a Python file and include it? Typically the reason for not usin
by krapp 3y ago
I mean, if it's just Python code as config for a Python, couldn't you just write your config in a Python file and include it?
Typically the reason for not using a full-blown programming language for config is to avoid Turing creep - the tendency to want to push complexity into config in order to make the application code simple. At some point the config gets to complex it needs its own config.
I run into this temptation using Lua a lot. Lua tables are perfect for config, but it would also sometimes be so convenient to just pop on a metatable and turn it into a class, maybe a proper API, when really all I need is a table that defines constants, maybe some conditionals, arrays, a map and that's it.
- zvr 3y agoI like having a config file like: host thatmachine.example.org port 9991 dbhost server.example.org ... which I can definitely parse myself. But it's also valid Tcl, if host/port/dbhost are defined proc's! So this allows people to be able to create config files like: set mydomain example.org host thatmachine.$mydomain dbhost server.$mydomain if {$mydomain == example.org} { port 12345 } else { port 9991 } I don't expect people to create huge programs in their config files, but being able to give them a "full-blown programming language" for free is sometimes desirable.