I feel that Yaml sucks. I understand the need for such markup language but I think it sucks. Somehow it’s clunky to use. Can you explain why?

  • NostraDavid
    link
    fedilink
    arrow-up
    4
    ·
    edit-2
    3 months ago

    YAML is fine if you use a subset (don’t use the advanced features - not like you know those anyway) and use explicit strings (always add " to strings), otherwise things may be cast when you did not intend values to be cast.

    Example:

    country: NO (Norway) will be cast to country: False, because it’ll cast no (regardless from casing) to false, and yes to true.

    country: "NO" should not be cast.

      • FizzyOrange
        link
        fedilink
        arrow-up
        7
        ·
        3 months ago

        That appears to not support comments. How they made that mistake after JSON is a mystery.

        • palordrolap@fedia.io
          link
          fedilink
          arrow-up
          1
          ·
          3 months ago

          That’s a thorny question: Do comments need to be in the base standard, or can that be offloaded to those building on it? It doesn’t look like it would be hard to have (comment "foo bar baz") in an expression and have a re-parser throw that out.

          Is the complaint that no two groups of people will use the same comment standard if left to their own devices? It’s not like the other data from different sources will always match up. What’s one extra, and fairly easy to handle SNAFU?

          That said, yes, I think I’d be more comfortable knowing there was an accepted comment format. The aesthetic seems to be Lisp-like, and I notice that the Lisp comment marker, the semicolon, is currently a reserved character, that is, it’s illegal to use it unquoted. Maybe they’re thinking of adding that at some point.

          • FizzyOrange
            link
            fedilink
            arrow-up
            2
            ·
            3 months ago

            It doesn’t look like it would be hard to have (comment “foo bar baz”) in an expression

            That is pretty much what the official “solution” is for comments in package.json - add "//": "foo bar baz" keys to dictionaries and NPM will ignore them.

            In practice it’s terrible. You need real comments.