That's a Lot of YAML

(noyaml.com)

47 points | by hisamafahri 3 hours ago

17 comments

  • fodkodrasz 55 minutes ago
    There is no problem with YAML, just like there was no problem with XML at all. The problem is with the software devs who use it for the wrong thing. I just wonder why JSON doesn't get all the hate, while it is a terrible format also: it is not streamable (YAML is), it doesn't have comments... and non-standard workarounds are used for these features. Norway better than YAML, in my opinion.
    • Diti 45 minutes ago
      I also wonder why it’s the 2012 version of the language who gets all the hate, instead of the hate being directed at Google, who doesn’t care about putting resources towards updating the main offender, Kubernetes’ YAML 1.1 parser. https://github.com/kubernetes/kubernetes/issues/34146#issuec...
    • vkazanov 20 minutes ago
      There numerous problems with YAML. It is underdefined, ambiguous, fragile, and is just impossible to write a portable parser for.

      JSON is naive, lacks almost everything. But is supereasy to parse and read.

      As funny as it sounds, XML is overspecified. Parsing is possible and predictable but supporting the full standard (all of them) is so much work that nobody does it anyway.

      So, given the choice above, i'd go for naive simplicity.

      • DanielHB 13 minutes ago
        There is a subset of yaml which is like 99.9% of all yaml code that is fine.

        And then you have whatever the hell OpenAPI uses.

        • vkazanov 9 minutes ago
          Yes, true, there is this legendary subset... but parsing even a sane subset of the spec is a nightmare for all parties involved.
    • _ink_ 46 minutes ago
      There are plenty of problems with YAML as the article shows. The biggest problem with YAML is, that serializer and deserializer need to agree on rules outside of the spec, because otherwise they can be both compliant and still don't understand each other.
      • riffraff 34 minutes ago
        isn't this true for most formats? You'd use a string to encode a date or version in JSON just like you would in YAML[0].

        Either you have an infinite spec, or you always have things outside it.

        [0] YAML would allows you to tag the type, but nobody does it anyway

    • hatthew 20 minutes ago
      I find json annoying to write a lot of the time, but I do enjoy that it's a lot more difficult to get wrong than yaml. The json spec is pretty clear, and can be learned and memorized by any programmer in 5 minutes. I'd much rather write in a format that's slightly annoying than a format that's slightly ambiguous.
    • dghf 23 minutes ago
      YAML is (or at least, is declared by its maintainers to be) a superset of JSON, making any JSON document also a valid YAML document.

      So surely if YAML is streamable, JSON must be too?

      Or are the YAML maintainers incorrect?

      • fodkodrasz 3 minutes ago
        > YAML is (or at least, is declared by its maintainers to be) a superset of JSON, making any JSON document also a valid YAML document. > So surely if YAML is streamable, JSON must be too?

        Given YAML is not a subset, but a superset of JSON, as you correctly noted, I'm not sure how you reached that conclusion.

        > Or are the YAML maintainers incorrect?

        I think you should check this page before making snarky comments: https://en.wikipedia.org/wiki/Superset

        See also the comment below: https://news.ycombinator.com/item?id=49476489

        Offtopic note: I wanted to dig the wiki superset link up the lazy way, so searched for superset, and all I got was endless list of marketing trash links. Even on DDG. RIP, we are on the Dead Internet.

      • boricj 10 minutes ago
        I wrote a C++ library at work that, among other things, serializes/deserializes to JSON, CBOR and BSON. I don't get that point.

        The first two formats I've implemented as fully streaming, the serializers emit into an output iterator one character/byte at a time and the deserializers only need to hold one value at a time (mostly for strings, and not even for CBOR's byte arrays, which are streamed). BSON requires full document instantiation because of byte offsets and is genuinely anti-streaming in its design.

        I happen to have implemented a serializer for YAML, fully streaming, mostly as a compact-ish human-readable debug data representation. I can scarcely think of fates worse than having to write a spec-compliant YAML parser.

      • vkazanov 14 minutes ago
        Yaml streams are just yaml docs separated by "---" withing a single file.

        The json spec just doesnt do anything like that but jsonl does.

    • einpoklum 30 minutes ago
      > Norway better than YAML, in my opinion.

      I agree that Norway is better than YAML. Let's keep Norway and dump YAML.

      > There is no problem with YAML

      I am reminded of: "There are no American infidels in Baghdad. Never!"

    • mogoh 35 minutes ago
      I, for one, hate JSON.
  • fypanto 42 minutes ago
    chuckle

    Well most of that is due to 1.1 which has been deprecated god knows for how long.

    1.2 does not have the 'Norway' problem any more.

    Tooting my own horn, this is how a modern YAML library looks like nowadays:

    https://github.com/pantoniou/libfyaml

    • 7bit 12 minutes ago
      I read that as libfuckyaml
      • fypanto 8 minutes ago
        Maybe you should get your mind out of the gutter then.
  • NoboruWataya 45 minutes ago
    Surprised TOML didn't get mentioned in the alternatives section, it's probably my favourite configuration format.

    I'm working on a project now that uses YAML for configuration (it makes more sense in this context than TOML) and am parsing it using Rust's `serde` crate (via `serde_norway`). It's not so bad if you use `#[serde(deny_unknown_fields)]` everywhere.

  • coder-pm 10 minutes ago
    It’s because ppl are not using it correctly, it was designed for configs and now it’s being used as a programming language… a language without types and debugger. It’s frustrating devs because they find the issue at the deployment time, not the compile time.

    Personally I did never pick the YAML as a first format for the configs, only my ruby friends did that.

    • kelnos 9 minutes ago
      It's also terrible for configs, for many of the reasons specified in the article.
  • grim_io 6 minutes ago
    Thanks for the page, I'll feed it to the LLM when it writes yaml next time, probably today.

    I won't even look at it, and it will be just fine.

  • elfrinjo 49 minutes ago
    Put quotes around your strings an you'll be mostly fine.
    • aniviacat 34 minutes ago
      It really is that simple.

      You really should not blame it on YAML that if you put a random hash value in a field that it may be a number. Like, duh. If you want a string, use quotes.

    • 9dev 46 minutes ago
      And use Alpha-3 country codes which are superior in any possible way regardless of YAML :)
    • einpoklum 33 minutes ago
      > you'll be mostly fine.

      You mean other than when we won't be? :-(

  • discreteevent 47 minutes ago
    - "something broke" is way better than stack traces with line numbers

    That sums it up. Its the same since the days of XML. Someone decides to make something configurable externally and then everything gets put in there for convenience. Now we are programming in XML/YAML without even a stack trace (or a debugger, or call hierarchy, or type checking or ... )

    • LeBit 14 minutes ago
      Pretty sure strictyaml tells you which line was faulty.
  • vova_hn2 6 minutes ago
    I'm still sad that JSON5 never became industry standard.
  • ChocolateGod 22 minutes ago
    I think a format that relies so heavily on invisible characters is terrible, but thats just me.
  • pi-victor 39 minutes ago
    there's already a better alternative, it's called starlark.
  • cheptsov 53 minutes ago
    Next time the author would like to write an article like that, it’s better that they offer a new standard that is as flexible while also doing the work YAML is doing today
    • embedding-shape 51 minutes ago
      EDN? Probably too flexible from some perspectives. No surprise Norways though.
      • cheptsov 42 minutes ago
        That’s the problem people IMO don’t understand - flexibility is one of many requirements; simplicity and ecosystem around are two more.

        Hating YAML is same as being childish - yo using like something but can’t come up with anything better. Worse than YAML can be only complaining about YAML. Hating YAML is a cliche.

        Its much easier to come up with jokes like this website than to change the ecosystem for better.

        And I definitely think the websites like this is opposite to the engineering approach.

        Not defending YAML though in particular.

        Edit: grammar

        • embedding-shape 15 minutes ago
          > That’s the problem people IMO don’t understand - flexibility is one of many requirements; simplicity and ecosystem around are two more.

          Biggest issue IMO is moving goal posts and people wanting one format to do it all. Different formats are good for different things, except YAML, which again tries to do it all yet excels at nothing.

        • fodkodrasz 25 minutes ago
          The modern societies are being infantilized. This is a symptom of that.
    • Ygg2 17 minutes ago
  • polotics 40 minutes ago
    This is hilarious, and so true!
  • erlich 55 minutes ago
    I actually like the SQL example.
    • 9dev 47 minutes ago
      right? Sensible nesting (that's how I'd break and indent a long query anyway), folding in proper code editors, proper hierarchy... what's not to like?
      • neilv 3 minutes ago
        That `AND:` being prefix-order was the hint it just needs a few small finishing touches:

          (select (num name)
             :from  customers
             :where (exists (select name
                               :from  orders
                               :where (and (= customers.num
                                              orders.customer_num)
                                           (< price 50)))))
  • boobsbr 37 minutes ago
    Wait until you find shell code inside a pipeline YAML definition. Now that's programming with YAML.
  • zahrevsky 50 minutes ago
    Am I the only one who finds this writing style hard to read?

    I stumbled upon this page a few years back and was very confused by the language. It took me some time to parse it and realize that all the comments are actually sarcastic. Overall, the general style feels like I'm reading comments on TikTok.

    It's not that I'm against this style; it's just that you don't expect it in a technical article.

  • taspeotis 47 minutes ago
    Yelling At My Laptop
  • XorNot 21 minutes ago
    YAML is fine. TOML is a lot worse.

    Nobody anywhere needed more INI files.

    • inanothertime 11 minutes ago
      > YAML is fine. TOML is a lot worse.

      Care to elaborate? We are using TOML for config files and just do fine.