News for hackers. Stuff that matters.
Re:JSON as configuration files: please don’t (2016) by raphinou on Saturday April 13, 2019 @02:50PM (#19654972)
I never did, what problems did you encounter?
Re:JSON as configuration files: please don’t (2016) by mmastrac on Saturday April 13, 2019 @02:54PM (#19655005)
Not the parent commenter, but it really gets tough to figure out _where_ you are in a bunch of nested lists, objects, etc deep down in the yml file. When the schema gets complicated enough you start having to refer back to the documentation to understand what syntax a particular item needs (I'm looking at you, docker compose!)

One example from a larger file:

  networks:
    macvlan51:
      driver: macvlan
      driver_opts:
        parent: eth0.51
      ipam:
        config:
          - gateway: 192.168.51.1
            subnet: 192.168.51.0/24
Maybe I'm just getting older and dumber, but that hyphen under config seems completely arbitrary to me (and the necessity of it is poorly documented in the manual). This gets magnified to the extreme as your config file grows. Maybe this is a list of objects under a key? Who knows.

Edit: OK, it looks like hyphens indicate arrays in the schema but for me it feels like a guess as to which one of these to use for each particular case.

Re:JSON as configuration files: please don’t (2016) by breck on Saturday April 13, 2019 @03:11PM (#19655113)
Without the hyphen configs value would be an associative array. With it it’s a list.

I’ve been editing long sublime-syntax files recently and I do not like it much. But I’m also not sure if JSON would be better for such a thing.

Re:JSON as configuration files: please don’t (2016) by jayd16 on Saturday April 13, 2019 @03:48PM (#19655324)
Whats the point of a list of tuples? Order? Json seems more immediately obvious and consistent in this case ie [{a:b},...]
Re:JSON as configuration files: please don’t (2016) by detaro on Saturday April 13, 2019 @03:56PM (#19655373)
It's not a list of tuples, it's a list of dictionaries.
Re:JSON as configuration files: please don’t (2016) by jayd16 on Saturday April 13, 2019 @03:59PM (#19655388)
Ah, but my confusion just deepens my point, haha.
Re:JSON as configuration files: please don’t (2016) by detaro on Saturday April 13, 2019 @04:07PM (#19655440)
It's mostly a question of what you're familiar with. JSON using [] and {} to denoting list vs dict isn't fundamentally easier than "-" and a prefix-less list of key:value pairs. YAML has a bunch of extra complexity, but IMHO this difference is really not it.
Re:JSON as configuration files: please don’t (2016) by afiori on Saturday April 13, 2019 @06:05PM (#19656037)
From a syntax standpoint parenthesis are extremely more clear than prefixes+whitespace (maybe less readable).
Re:JSON as configuration files: please don’t (2016) by smt88 on Saturday April 13, 2019 @03:30PM (#19655232)
Semantic whitespace is a nightmare. It's also sometimes I ambiguous whether things are ints, bools, or strings.