r/ProgrammerHumor • • 5d ago

Meme formatsWithSuperiorityComplex

Post image
3.0k Upvotes

402 comments sorted by

View all comments

335

u/rjwut 5d ago

Heck no, YAML can go suck an egg.

  • Implicit type conversion issues such as the Norway problem
  • Syntatically meaningful whitespace
  • Enormous, complicated grammar

No thanks. JSON for computers talking to computers, JSON5 for configuration written by human beings. ESM if you're already writing in JavaScript/TypeScript and the config is potentially complex.

91

u/L30N1337 5d ago

genuinely. the more I hear about YAML, the more I hate it. It seems to be the Embodiment of everything I personally hate about certain programming languages, jammed together.

59

u/rjwut 5d ago

I think it's funny that JSON has no implicit type conversion, but was derived from JavaScript, a language that does and is often criticized for it. And then somebody with the stink of death about him thinks, "Let's put implicit type conversion back in, and throw in Python's syntactically-meaningful whitespace while we're at it" and invents YAML.

8

u/pterencephalon 5d ago

I use TOML because it at least deals with the type issues

1

u/bustus_primus 5d ago

I like toml but i wish it handled nesting better. The format is generally flat which can be hard to read for complex configs

2

u/toric5 4d ago

Someone hasnt looked at toml 1.1.

2

u/bustus_primus 3d ago

Hm i guess i will be looking at toml 1.1

38

u/chat-lu 5d ago

JSON for computers talking to computers

Hell no. JSON to provide the lowest common denominator. We have much better interchange formats when you control both ends of the conversation.

JSON5 for configuration written by human beings.

Which usually means that you pre-process the comments out, or you pass it through a YAML decoder because JSON5 is valid YAML. Just use toml.

6

u/hennypennypoopoo 5d ago

TOML is the way for configuration. If you can't make it look nice in TOML, it shouldn't be a configuration option.

10

u/rjwut 5d ago

We have much better interchange formats when you control both ends of the conversation.

Agreed. I was mostly referring to when you don't control both ends.

Which usually means that you pre-process the comments out, or you pass it through a YAML decoder because JSON5 is valid YAML. Just use toml.

I disagree with your assertion that JSON5 is valid YAML (comment styles; `\n` within single-quoted strings; incompatibilities with hex numbers, unary `+` operators, multiline strings with escaped newlines). But I do agree that TOML is good.

3

u/CrossScarMC 5d ago

JSON for computers talking to computers

That's what MessagePack is for, it's really a shame it hasn't been adopted very much.

1

u/toric5 4d ago

Or CBOR!

1

u/rjwut 5d ago

Yeah, no matter how much you like a particular format, if you don't control the other side and they don't support it...

2

u/Prawn1908 5d ago

JSON for computers talking to computers

JSON should absolutely not be the top choice for computer-to-computer data transfer. JSON wastes a ton of space and incurs far more serializing/parsing time for the sake of human readability.

Agreed yaml is stupid though.

5

u/rjwut 5d ago

I would be 100% in agreement if byte economy were the only thing that mattered in all cases.

1

u/Prawn1908 5d ago

Developers not caring about byte economy or things like parsing time is why the web is a glacially slow mess right now. It's fucking insane that 99% of webpages have any perceptable load time given the amount of data actually presented to the end user.

1

u/rjwut 5d ago

I didn't say byte economy isn't important. I said it's not the only thing that matters.

1

u/Prawn1908 5d ago

What else is more important? If a human isn't the intended originator or recipient of the data, JSON (or any other plaintext format) has zero benefits and only downsides over a streamlined binary format.

1

u/rjwut 4d ago

Perhaps in the age of AI it matters less, but human readability becomes a factor if a human has to diagnose a problem.

2

u/Prawn1908 4d ago

Just use a parser to decode the data stream you're diagnosing. There's no reason to belabor the computers with additional construction/parsing workload and data size.

-8

u/Do_TheEvolution 5d ago

but if you make configuration file in json instead of yaml, you can go suck all them eggs with your sea of {}{}{{{{}}{}{{{{}}}}{}

16

u/rjwut 5d ago

I'd take that deal any day of the week.

→ More replies (1)

11

u/ExdigguserPies 5d ago

Whitespace makes this problem worse, not better

→ More replies (5)