3 ms·
One of the major use-cases for YAML is as a host language for DSLs, essentially basic programming languages for specific use-cases. TOML isn't as good there, as
by DougBTX 4y ago
One of the major use-cases for YAML is as a host language for DSLs, essentially basic programming languages for specific use-cases. TOML isn't as good there, as these languages often need deep nesting of data structures. GitHub Actions is the obvious example.
- omnicognate 4y agoYeah, toml isn't great for that. It's greatly preferable to yaml for human-readable config. Json is better as a serialisation format. DSLs are bit vexed, not least because they're often horrible in themselves - cruft-accumulating hacks with no tooling, blurring the distinction between code and config often as a workaround for unwieldy dev processes. That's certainly not true of all DSLs, though (can't speak for Github Actions) and there is a need for a simple common base syntax/parser for them. I don't think yaml is a good solution. Being a cantankerous old git, I tend to think the problem of a common base syntax/parser for DSLs was solved 70 years ago: s-expressions/lisp.
- DougBTX 4y agoYes, agreed. I've found TOML for config to be quite nice. This is my go-to article for discussions about generic languages vs DSLs: http://mikehadlow.blogspot.com/2012/05/configuration-complexity-clock.html http://mikehadlow.blogspot.com/2012/05/configuration-complex... I'm very iffy on DSLs in general. One that I'm using at the moment has foreach loops but no if statements! And... all the inputs must be specified in a YAML file!
- int_19h 4y agoQuite frankly, all YAML DSLs in the wild are terrible, so if that's a major use-case, I'd say it was a failure.
- bccdee 4y agoA great alternative for stuff like that is https://kdl.dev/ https://kdl.dev/, which feels much more natural for DSLs.