• 0 Posts
  • 27 Comments
Joined 1 year ago
cake
Cake day: June 26th, 2023

help-circle



  • It’s inconsistent and annoying. Expressive, yes. Gets it’s job done, yes. Absolute nightmare of a spec, YES.

    The fact that JSON is a subset of YAML should tell you everything about how bloated the spec is. And of course there’s the “no” funny things.

    Personally, my favourite way to write configs was using lua (because it was already part of the project so why not), but JSON does fine.




  • In slav languages, you just go with how the neologism sounds. “Computer” ends in hard r, so it’s masculine, for example.

    Every once in a while there’s going to be shit like with “coffee” though. It sounds neutral-gendered and is officially neutral-gendered, but there’s been a big period when people believed it should be masculine because of the source language or some shit. Still a lot of people arguing about it.


  • Well, there’s a few things I personally think are a must for a config format:

    1. It must be human readable and editable, in some way. - in many cases, you may want to go and change something in the config while the application proper isn’t running. That rules out stuff like pickle or binary formats. Although I suppose sqlite and it’s ilk still fulfill it, in a roundabout way.
    2. It should be unambiguous, with one way to do something right. - this one’s a doozie. JSON fulfills it since it’s unambiguous about it’s types, but many interpreted language configs will have options. And then YAML will have “no” turn into “false”.
    3. It should probably have comments. - handily failed by standard JSON implementations. Although to be fair a lot of parsers I’ve used understand comments. Or you can make a comment stripper real easily.
    4. It should have obvious structure. - I’ve dealt with CSV configs before, I do not want to ever again.

  • Oh god, parsing complexity. I actually tried writing a YAML parser in my free time before and boy was that not worth the headache. So many little things that complicate parsing and are ignored by majority of users!

    I really like python, but I can agree that it’s no-delimiters style can be… Confusing at times. I definitely had to hunt down bugs that were introduced by wrong indentation. That and the way it handles global/local variables, mostly.

    I do appreciate not having to enclose every key in “”, and being able to copy values - but if we want that kind of logic making our configs, why not just switch to writing configurations in Lua? It certainly has less footguns than YAML and it has the niceties like “I can just write {key = "value"} instead of {"key": "value"}”.






  • Well, if you’re writing something the user will be looking at and clicking on, you will probably want to have some sort of state management that is global.

    Or if you’re writing something that seems really simple and it’s own thing at first but then SURPRISE it is part of the system and a bunch of other programmers have incorporated it into their stuff and the business analyst is inquiring if you could make it configurable and also add a bunch of functionality.

    I also had to work with a system where configurations for user space were done as libraries setting global constants. And then we changed it so everything had to be hastily redone so that suddenly every client didn’t have the same config.