3 ms·
It seems like a lot of people don't understand that having a DECLARATIVE language/configuration/whatever such a huge advantage it's insane. It's so easy to writ
by kissgyorgy 5y ago
It seems like a lot of people don't understand that having a DECLARATIVE language/configuration/whatever such a huge advantage it's insane. It's so easy to write, you can never make logical mistakes, avoid all kind of bugs, it's just easy to learn and you can just write the desired result.
I never understood these project where somebody makes a very easy declarative thing and makes it imperative.
Programming in Python is order of magnitude "harder" and error prone than writing a simple YAML file.
- BiteCode_dev 5y ago> Programming in Python is order of magnitude "harder" and error prone than writing a simple YAML file. For a simple config, sure. But as soon as you have something more complicated, you end up with: - a frankenstein monster DSL, with pseudo flow control + funcs backed in through a patched up templating system - weird error messages, no stack trace, and type errors that accumulates - no DRY - no tooling: type checks, linting, de bugger, logger. Forget about it. Case in point: ansible playbooks. So unless your config is going to stay under 20 lines, just use a real programming language. If you don't want to use Python, fine. Use dhall, nix, jsonet or something else.
- erinnh 5y agoYou have linting and logger in Ansible. Type checks, kind of depend. Debugging is definitely something I also would like to see something better coming out of Ansible than what is currently available.
- dvdkon 5y agoSlightly relevant: I made a hack to write Ansible playbooks in Python [1]. It doesn't fix everything, for example runtime control flow still has to be described as attributes of tasks, but it does help with parametrising. It's a question whether it's worth it to add such a hack or if I should just make do with YAML. [0]: https://gitlab.com/-/snippets/2112382 https://gitlab.com/-/snippets/2112382
- BiteCode_dev 5y agoIt's a great hack actually.
- dvdkon 5y agoHave you seen the kind of "config files" YAML is being used nowadays? Gitlab CI, Ansible, Saltstack, various low-code tools... It's no better than a scripting language, because it turns out if what you need is to encode logic and control flow, you can't get away from it by shouting "DECLARATIVE" and pretending the problems don't exist. Pretty much all of these complex tools that use YAML don't use it for declarative purposes, but as a kind of hybrid AST/DSL. You're not avoiding anything except for maybe the need to parse a proper language.