3 ms·
> Django using Python for configs made me fall in love with this. I also started advocating in-language configuration files (Python for Python, but also Lua fo
by BugsJustFindMe 5y ago
> Django using Python for configs made me fall in love with this.
I also started advocating in-language configuration files (Python for Python, but also Lua for Lua, etc) a number of years ago because it lets you do really useful things (like functionally generating values, importing shared subsets of data, storing executable references, and ensuring that two keys return the same values without manual copy/paste) all without needing to spec and use Yet Another Thing™ that does only a fraction of what the programming language you're already using already does.
- eptcyka 5y agoThat also implies that you can't just test a foreign config file without first reading and understanding what it does, as just using one would imply arbitrary code execution.
- kevin_thibedeau 5y agoThis is a place where Tcl excels. You can easily create restricted sub-interpreters that can't do anything dangerous. If you need more power for trusted scripts you just reenable selected commands.
- spacechild1 5y agoSame thing with with Lua!
- pjmlp 5y agoThat is how our Tcl based application server was, the configuration files were a Tcl DSL.
- Jnr 5y agoUsing the programming language to do the comments works only when using some scripting language. Things that get compiled can't really use it without recompilation.
- mike_hock 5y agoBut you can embed Lua or Python using its C interface.