Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

YAML sucks but so does TOML, especially when it comes to nested data structures like the layout.yaml shown on the front page.

There are no good configuration languages in existence and there never will be. We have rejected Lisp/sexp so now we must suffer endlessly.



I think JSON would be perfect if it a) allowed comments, and b) had multi-line strings.

It has exactly five data types, each with very clear and distinct notation that nests consistently (the top level isn't somehow "special" and there's no messing with significant whitespace). Only two collection types: keyed, and unkeyed. In some sense it feels like the apotheosis of untyped data-modeling.


a) reminds me so much of this classic

https://thedailywtf.com/articles/the-inner-json-effect

“Tell us what you did to JDSL,” one of the VP’s asked.

“I don’t think I did anything,” Jake answered. “I’ve only been here two weeks, trying to learn JDSL and how the customer portal works. I don’t even know how to deploy it!”

“You made a few commits to Subversion!” Tom shouted.

“Well, yes. I added a few code comments, trying to–”

“You can’t use comments in JDSL!” Tom shouted. “THAT’S WHAT BROKE IT!!”


That 100% has to be fake. I NEED it to be fake. Are there production systems that work like this? Du they have one "rockstar" developer who does stuff like this?


Most of TDWTF is a kernel of truth surrounded by about three pages of fiction.


I just wish JSON had fixed decimal numbers, a timestamp type, and a binary blob type :/


I agree that TOML sucks for nested structures.

JSON5 is probably the best option at the moment.

https://json5.org/

* Instantly obvious what the structure is (unlike YAML or TOML).

* Everyone knows JSON already. This just makes it a bit nicer.

* No noob security mistakes or type confusion caused by underquoting like YAML.


Don't forget the truncation problem with YAML/TOML. A partially read/transmitted YAML/TOML file is often still considered valid.


That also makes it really easy to concatenate them, either `cp a.yaml + b.yaml c.yaml` or just `cat a.yaml >> b.yaml` - which is quite nice, compared to trying to do this with JSON etc... files.


I would say that Dhall is fine, just from a parallel universe.

JSON is close to sexps, but it sucks when comments are not allowed.


Which is why EDN is so much better for config.


Have you looked at Cuelang [1] as a configuration language or source of truth?. It's still new but it's a superset of JSON but attempted to combine data/schema into one and reject inheritance and replace with validation instead.

[1] https://github.com/cuelang/cue/tree/master/doc/tutorial/basi...


Take a look at HOCON (Human-Optimized Config Object Notation)

https://github.com/lightbend/config/blob/main/HOCON.md


Yes! I logged in just to mention HOCON, then I noticed you have mentioned it already :- )

So, the project you linked to is Java / Scala: https://github.com/lightbend/config

And there're also (basic? complete?) HOCON parsers in Javascript and Rust — I investigated this a while ago, because I want to use HOCON everywhere in my projects:

https://docs.rs/hocon/0.5.1/hocon/ (Rust)

https://www.google.com/search?q=hocon+javascript (Js, a few different)

The Rust version:

> This implementation goal is to be as permissive as possible, returning a valid document with all errors wrapped in `Hocon::BadValue` when a correct value cannot be computed

How nice :- ) (it seems to me)


I agree about sexps, it feels like the right default for storing human readable data. The only place where I think it's a little weak is when used more like markup, since data would need to be in quoted strings.

That definitely seems like a solvable problem though.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: