this post was submitted on 15 Aug 2023
1 points (100.0% liked)

Technology

34680 readers
600 users here now

This is the official technology community of Lemmy.ml for all news related to creation and use of technology, and to facilitate civil, meaningful discussion around it.


Ask in DM before posting product reviews or ads. All such posts otherwise are subject to removal.


Rules:

1: All Lemmy rules apply

2: Do not post low effort posts

3: NEVER post naziped*gore stuff

4: Always post article URLs or their archived version URLs as sources, NOT screenshots. Help the blind users.

5: personal rants of Big Tech CEOs like Elon Musk are unwelcome (does not include posts about their companies affecting wide range of people)

6: no advertisement posts unless verified as legitimate and non-exploitative/non-consumerist

7: crypto related posts, unless essential, are disallowed

founded 5 years ago
MODERATORS
 

cross-posted from: https://programming.dev/post/1743099

.yaml, .toml, etc?

top 8 comments
sorted by: hot top controversial new old
[–] glibg10b@lemmy.ml 1 points 1 year ago (1 children)

There is no best. It depends on the application

[–] balls_expert@lemmy.blahaj.zone 0 points 1 year ago (1 children)
[–] glibg10b@lemmy.ml 1 points 1 year ago

Some applications don't have enough config entries to warrant support for nested entries

Some applications need variable-length data, and some even variable-length lists

Some applications don't care about having fast read/write times or a small memory footprint and can do with more complex formats that require the use of third-party libraries

Some embedded applications (e.g. AVR) don't have access to a whole lot of libraries

[–] silent_squirrel@feddit.de 1 points 1 year ago
[–] JackbyDev@programming.dev 1 points 1 year ago (1 children)

The one already being used by the project.

[–] sugar_in_your_tea@sh.itjust.works 1 points 1 year ago (1 children)

Yup. If I have to pick one for a new project, I'll go with TOML unless there's a reason to pick something else. I like that it's simple, while also having a bunch of features for when the project grows.

[–] JackbyDev@programming.dev 1 points 1 year ago (1 children)

Pretty much same here. With Spring stuff I still use YAML because TOML doesn't have first class support yet. If TOML is an option I don't have to go too far out of my way for them I go for it.

YAML has too many foot guns. It's still less annoying to read and write than JSON though. Properties files are okay but there doesn't seem to be an agreed upon spec, so for edge cases it can be confusing.

[–] sugar_in_your_tea@sh.itjust.works 1 points 1 year ago* (last edited 1 year ago)

Yup, YAML is a terrible data format, but for a configuration format that you completely control, it works well. Your parser only needs to be good enough to read the configs you create.

Likewise, JSON is a pretty bad config format due to strictness in the syntax (no optional commas, excessive quotes, etc), but it's pretty good data format because it's pretty easy to parse.

TOML is like YAML, but it has fewer corner cases so it's pretty easy to learn completely.

Though anything is superior when it's already the status quo on a project.