1211
you are viewing a single comment's thread
view the rest of the comments
[-] UrbonMaximus@feddit.uk 33 points 10 months ago

Let me introduce you to YAML, you'll love it!

[-] CoderKat@lemm.ee 14 points 10 months ago

Ugh, there's some parts of YAML I love, but ultimately it's a terrible format. It's just too easy to confuse people. At least it has comments though. It's so dumb that JSON doesn't officially have comments. I've often parsed "JSON" as YAML entirely for comments, without using a single other YAML feature.

YAML also supports not quoting your strings. Seems great at first, but it gets weird of you want a string that looks like a different type. IIRC, there's even a major version difference in the handling of this case! I can't remember the details, but I once had a bug happen because of this.

Performance wise, both YAML and JSON suck. They're fine for a config file that you just read on startup, but if you're doing a ton of processing, it will quickly show the performance hit. Binary formats work far better (for a generic one, protobuffers has good tooling and library support while being blazing fast).

[-] sonnenzeit@feddit.de 8 points 10 months ago

It's so dumb that JSON doesn't officially have comments.

So much this.

Used to work at a company where I sometimes had to manually edit the configuration of devices which were written and read in JSON. Super inconvenient if you have to document all changes externally. As a "hack" I would sometimes add extra objects to store strings (the comments). But that's super dicey as you don't know if it somehow breaks the parsing. You're also not guaranteed the order of objects so if the configuration gets read, edited and rewritten your comment might no longer be above/below the change you made.

Always found it baffling that such a basic feature is missing from a spec that is supposed to cover a broad range of use cases.

[-] vrighter@discuss.tchncs.de 5 points 10 months ago

json 5 does support comments. alternatively, yaml is a superset of json. any valid json is also valid yaml. but yaml also supports comments. So you can also write json with comments, and use a yaml parser on it, instead of a standard json parser

[-] lhamil64@programming.dev 5 points 10 months ago

One of these days I'll actually look up how YAML indentation works. Every time I use it it's trial and error until I stop getting errors.

[-] merc@sh.itjust.works 2 points 10 months ago

That's a super risky way to do it. It might stop giving you errors because you finally got the indentation right, or it might stop giving you errors because you got the indentation "right" but not how you you meant to organize the objects.

[-] dansity@lemmy.dbzer0.com 3 points 10 months ago

I got my hair torn out till I setup my home assistant. I f*cking hate it its stupid

this post was submitted on 05 Sep 2023
1211 points (97.3% liked)

Programmer Humor

18292 readers
1392 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 1 year ago
MODERATORS