3 ms·
> but generally I just want a set of knobs to tweak behaviour. But you can do that so easily as well! Like, take this YAML (substitute equivalent JSON or TOML,
by OskarS 2y ago
> but generally I just want a set of knobs to tweak behaviour.
But you can do that so easily as well! Like, take this YAML (substitute equivalent JSON or TOML, specific configuration language is irrelevant):
options:
someOption: 14
nested:
foo: "some string"
bar: true
I don't see how that's so much easier than this version in Lua:
options = {
someOption = 14,
nested = {
foo = "some string",
bar = true
}
}
And when you do need to get a bit more complex, you have the the tools to manage that complexity. Like, if you have a bunch of very similar things (say, job definitions in CI/CD), you want a way to not repeat yourself so you only have to edit that once, YAML has a tool for that, "anchors" [1]. But it's obscure and a bit hard to use. In a real programming language, it's trivial: just stick the repetitive parts in a variable and use that. Or define a simple function in case most of the stuff is repeated, but some is not, so you can do
foo = generateRepetativeConfig('specificOption')
Or maybe you can just do that with a simple for-loop. And if you want to do something like a string substitution, you have a whole dang language with the tools you need to do it.
Dhall and languages like that are a big improvement, but really, I just want a normal programming language. We have decades of experience now with managing complexity in computer systems, and programming languages have evolved robust systems for handling that.
I agree that sandboxing and security can be a real concern for some of this stuff, in which case Starlark is perfect, though you can sandbox languages like Lua or various Lisps as well.
[1]: https://support.atlassian.com/bitbucket-cloud/docs/yaml-anchors/ https://support.atlassian.com/bitbucket-cloud/docs/yaml-anch...