NireBryce

reality is the battlefield

the first line goes in Cohost embeds

🐥 I am not embroiled in any legal battle
🐦 other than battles that are legal 🎮

I speak to the universe and it speaks back, in it's own way.

mastodon

email: contact at breadthcharge dot net

I live on the northeast coast of the US.

'non-functional programmer'. 'far left'.

conceptual midwife.

https://cohost.org/NireBryce/post/4929459-here-s-my-five-minut

If you can see the "show contact info" dropdown below, I follow you. If you want me to, ask and I'll think about it.


NireBryce
@NireBryce

I've got one more opinion until next week: you should never use json for your config file. yes even if it's not supposed to be user facing.

some day someone is going to need to dig into the config to debug something and the least you can do is let them use comments

"so... json-with-comments?" no. it's not a real standard and also in this house we do not "throw good money after bad". make your config yaml. make your config .ini. make your config in sh. I don't care. you're parsing options it doesn't matter what it's in. so make it in something that both supports code comments and syntax highlighting.

just don't make it in JSON. or if you do, have the user facing portion be in literally anything else and then juice it into JSON in the background if you need to be a filthy little gremlin about it.


bytebat
@bytebat

use ion instead. it's json but good. it supports comments, keys wizhout spaces don't need quotes, trailing commas don't bring zhe world to an end, it adds a few extra types (like date/times, binary blobs, and "annotations" which are really neat) wizhout adding too much bloat or making it hellish to parse, it has a schema specification (like json schema but an official part of zhe spec), it has a one-to-one binary representation zhat's more compact if you don't need human-readability, etc. it's a strict superset of json, meaning all valid json is also valid ion, so you can migrate existing files gradually. it's been around for several years and has libraries in several languages. it's good.


NireBryce
@NireBryce

we don't throw bad money after bad either in this house. but ion does look cool


You must log in to comment.

in reply to @NireBryce's post:

good luck finding that one again on a skim, though honestly highlighting engines really should comment-color those.

you don't even have to worry about the trailing comma being a footgun if you go full haskell gremlin and

[ prefix
, them
, like
, bullet
, points
],

in reply to @NireBryce's post:

jsonc is okay but changing a line in the middle still causes everything that hot reloads to panic and just ignore everything below it until you finish your line and add the trailing comma.

which is a problem elsewhere too, but the json parsers seem much worse at graceful degradation because they require a correct json file, whereas yaml and many others that are newline delimited don't. I've got too many opinions on this but json (even jsonc ("With Comments")) just feels uniquely unfit for purpose outside of jsonschema letting you have option tab complete ~easier.

but it's also 'lowest common denominator' so,