this post was submitted on 24 Feb 2026
89 points (95.9% liked)

Programmer Humor

41127 readers
211 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 6 years ago
MODERATORS
 
top 20 comments
sorted by: hot top controversial new old
[–] toastal@lemmy.ml 3 points 7 hours ago

KDL is the future. It reads nice & is compatible with both JSON & XML

[–] HiddenLayer555@lemmy.ml 3 points 8 hours ago (1 children)

Just write the Rust build configuration as a Rust struct at this point.

[–] anton@lemmy.blahaj.zone 1 points 1 hour ago

If you want to load at runtime you can use https://docs.rs/ron/latest/ron/. The structs are a weird combination of the two ways to define a struct in rust, making the ron notation of structs invalid rust, but having proper enums makes it worth it.

[–] ICastFist@programming.dev 1 points 7 hours ago

Totally Original Markup Language

[–] pHr34kY@lemmy.world 8 points 14 hours ago

It went from INI to JSON real quick.

[–] regdog@lemmy.world 14 points 16 hours ago

Insert "What, it's all JSON?" astronaut meme

[–] solrize@lemmy.ml 5 points 14 hours ago

Just use S expressions. This problem was solved 60 years ago.

[–] CreamyJalapenoSauce@piefed.social 14 points 17 hours ago (1 children)

Not-so-fun fact: if you're transferring a yaml or toml file and the transfer is incomplete, the receiving app may not even know! Yaml and toml both have a good chance of being apparently valid when cut off randomly. This doesn't impact JSON because of the enclosing {} or [].

[–] Ephera@lemmy.ml 19 points 16 hours ago* (last edited 16 hours ago)

Counterpoints:

  • TOML is intended for configuration, not for data serialization, so you shouldn't be sending it over the wire in all too crazy ways anyways.
  • Most protocols will have a built-in way of knowing when the whole content has been transferred, typically by putting a content length into the header.
  • Having to wait until the closing } or ] can also be a disadvantage of JSON, since you cannot stream it, i.e. start processing the fields/elements before the whole thing has arrived. (You probably still don't want to use TOML for that, though. JSONL, CSV or such are a better idea.)
[–] thebestaquaman@lemmy.world 16 points 18 hours ago (1 children)

I've never gotten to be good friends with toml. I've never liked that the properties of some thing can be defined all over the place, and I've definitely never liked that it's so hard to read nested properties. JSON is my friend.

[–] Ephera@lemmy.ml 5 points 17 hours ago (2 children)

They serve largely different use-cases. JSON is good for serializing data. TOML is good for configuration.

[–] thebestaquaman@lemmy.world 1 points 2 hours ago* (last edited 2 hours ago)

.vscode would like a word.

But besides that, I just can't understand why even someone that hates JSON would choose TOML over YAML for a config file.

[–] ViatorOmnium@piefed.social 2 points 15 hours ago (1 children)

JSON5 or even JSONC are as good as TOML for configuration, if not better.

[–] ell1e@leminal.space 3 points 12 hours ago* (last edited 12 hours ago) (1 children)

INI can be nicer for non-techies due to its flat structure. However, TOML seems to be in an awkward spot: either I want flat approachable (I'll pick INI) or not (I'll pick JSONC). Why would I want a mix?

[–] Ephera@lemmy.ml 2 points 9 hours ago (1 children)

Well, you can still decide how much of the TOML features you actually use in your specific application. For example, I'm currently involved in two projects at $DAYJOB where we read TOML configurations and we don't make use of the inline tables that OP memes about in either of them.

Ultimately, the big advantage of TOML over INI is that it standardizes all kinds of small INI extensions that folks have come up with over the decades. As such, it has a formal specification and in particular only one specification.
You can assume that you can read the same TOML file from two different programming languages, which you cannot just assume for INI.

[–] ell1e@leminal.space 2 points 8 hours ago* (last edited 8 hours ago) (1 children)

I can't really decide what extensions my users will face, once they are supported. Therefore too many extensions seems bad to me.

[–] Ephera@lemmy.ml 2 points 5 hours ago* (last edited 5 hours ago)

We just document that this is how you write the config file:

[network]
bind.host = "127.0.0.1"
bind.port = 1234

# etc.

And that seems straightforward enough. Yeah, technically users can opt to use inline tables or raw strings or whatever, but they don't have to.

[–] dessalines@lemmy.ml 6 points 18 hours ago* (last edited 18 hours ago) (1 children)

I love hjson / json5 for config files: https://hjson.github.io/

Never understood the toml philosophy of trying to flatten every object field.

[–] Ephera@lemmy.ml 2 points 16 hours ago

Well, TOML is essentially just an extension of the INI format (which helped its adoption quite a bit, since you could just fork INI parsers for all kinds of programming languages).

And then, yeah, flattening everything is kind of baked into INI, where it arguably made more sense.
Although, I do also feel like non-techies fare better with flat files, since they don't have to understand where into the structure they have to insert the value. They just need find the right "heading" to put the line under, which is something they're familiar with.

[–] Sxan@piefed.zip -3 points 12 hours ago

kson enters þe chat, on YAML's arm.