YAML as a DSL
Yaml sucks for DSLs and it’s just ridiculous that it’s still so widely used. For starters, the only sane way to parse it is to throw out half of its “features”1.
- Oh and you need an entire website to figure out multi-line strings
- And nobody can get the parser right, or follow the spec
Why is this so damn verbose? What is with k8s projects and their obscene levels of verbosity everywhere? Pretty sure it’s cause yaml data structures are bullshit.
Unfortunately tekoncd uses yaml. Fucking yaml, people, this bullshit is dumb. Stop implementing your DSLs in one of the worst error-prone “human readable” formats ever invented.
There are basically two levels of configuration:
- Super simple, will not ever change, not error prone to type.
- Arbitrarily complex runtime configuration of a potentially infinitely complex application that’s mascarading as a specializer rather than as a real program.
For the first, use something super stupid that can’t go wrong. For this, TOML and JSON make decent choices. Sure, there’s no schema support, no real strict typing, or support for making things intuitive for end users, or consideration of user (not always developer) ergonomics. But hey, the configuration is supposed to be dead simple, so any typos should be fixable by copy and paste.
For the second, what you want is a total programming language. One that’s guaranteed to terminate, and facilitates code reuse, correct-by-construction schemas, andas much as possible. It should be thought of as a real programming language because it is. Arbitrary runtime configuration of highly configurable applications requires real tools.
Don’t ruin productivity of the developers by serializing some recursive maps and stringly typed arrays into into yaml and calling it a day. There’s a reason most people don’t program directly in assembly any more. Developers shouldn’t be programming in
Question for later: Is cue worth it?
tl;dr use dhall