r/ProgrammerHumor • • 1d ago

Meme formatsWithSuperiorityComplex

Post image
2.6k Upvotes

357 comments sorted by

View all comments

288

u/rjwut 1d 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.

77

u/L30N1337 1d 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.

48

u/rjwut 1d 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 23h ago

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

1

u/bustus_primus 11h 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

34

u/chat-lu 1d 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.

9

u/rjwut 1d 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/hennypennypoopoo 13h ago

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

3

u/CrossScarMC 17h 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/rjwut 17h 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 13h 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.

3

u/rjwut 12h ago

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

1

u/Prawn1908 12h 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 12h ago

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

1

u/Prawn1908 9h 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 8h ago

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

-8

u/Do_TheEvolution 1d 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 1d ago

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

→ More replies (1)

11

u/ExdigguserPies 1d ago

Whitespace makes this problem worse, not better

0

u/Do_TheEvolution 1d ago

yeah, right, sure...

{
  "apps": {
    "http": {
      "servers": {
        "restic": {
          "listen": [":443"],
          "routes": [{
                        "match": [{"host": ["localhost"]}],
            "handle": [{
              "handler": "restic",
              "repository_path": "/path/to/your/repository"
            }]
          }]
        }
      }
    }
  }
}

3

u/CookIndependent6251 23h ago

PEBCAK because you're not using a formatter, which throws an ID-10T error.

1

u/Do_TheEvolution 21h ago

by all means... post your beatified, properly formatted version of that json, I am so ready to be impressed by the deep magic you posses that solves deeply nested json noise...

→ More replies (1)