5 ms·
There can be, basically. But you often end up with huge repetitive mountains of JSON data, which isn't a ton of fun to maintain by hand, so then you write a to
by benley 9y ago
There can be, basically. But you often end up with huge repetitive mountains of JSON data, which isn't a ton of fun to maintain by hand, so then you write a tool to generate it from some other input data. Surprise, now you've invented a single-purpose DSL! What if you had a language that could serve as your input DSL, while remaining deterministic and still being flexible enough that you could skip the aforementioned dsl-to-json tool and just write that in the same config language? That's exactly what Nix is, along with some similar languages (Jsonnet, Dhall, Flabbergast, ...). They end up being useful as a way of generating whatever boilerplate or repetitive or obtuse input data you need to drive some system. Sure, you could do it in Python, but there's too many ways of doing non-deterministic non-hermetic things in a general-purpose language like that. Nix and Jsonnet and friends have no facilities for directly writing to disk, or talking to the network, or depending on some weird library being installed locally. They're just static configuration languages, and that can be extremely useful.