Hacker News new | ask | show | jobs
by UserIsUnused 2349 days ago
There are plenty of declarative programming language families. Lisps, MLs, SQLs. Configuration is code. Use a programming language.
2 comments

Here's an example of a config system using prolog: https://github.com/larsyencken/marelle

It's a hard to tell where marelle ends and the config begins, since it's all just prolog.

So how do you differentiate a declarative language like SQL with a declarative YAML file for Ansible?

What would be the benefit of adding a declaritive language into the mix over YAML?

Tooling. Data transformation. Libraries.

Emacs is configured using Lisp. Because of that it is amazingly configurable. XMonad uses Haskell, which gives types to avoid lots of error cases.

The thing is providing an actually programming language doesn't remove anything specially if the same config can be written as cleanly.

And you would avoid "YAML templates for creating YAML", when you actually need to process some data (even if it's just for pre/suffix creation in names). Secrets retrieval is another thing that you also need to do and template.

Also, YAML is a terrible to parse language, with can give out weird error cases. Other languages compilers/interpreters are more mature.

And ofc, if you provide SDKs for your IaC tool, you should be able to use the language that your developers are more familiar with. Taking advantage of the good practices their are used to. Don't limit with "declarative languages". Use a programing language that make more sense, and leave data languages for data.

If you want to build a DSL, build a DSL. DSLs are easily embeddable in the mentioned programming languages.

YAML is not typed and you can basically do whatever. The worst of all worlds.

> What would be the benefit of adding a declaritive language into the mix over YAML?

The capability to readily define, store in libraries, and use reusable abstractions that apply within a configuration or across multiple individual configurations.