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?

  • Eager Eagle@lemmy.world
    link
    fedilink
    English
    arrow-up
    11
    arrow-down
    1
    ·
    edit-2
    4 months ago

    You can’t say python’s whitespace usage is as bad as yaml’s. YAML mixes 2 and 4 spaces all the time. Python scripts don’t run if you write this kind of crap.

    And whitespaces is really just the tip of the iceberg of YAML problems…

      • Eager Eagle@lemmy.world
        link
        fedilink
        English
        arrow-up
        8
        ·
        edit-2
        4 months ago

        That’s part of the problem. Different number of whitespaces indicate different nesting levels and the YAML spec does not enforce them. These two horrible YAMLs are valid and are not equivalent:

        a:
         b:
             - c
             -  d
              - e
        f:
            "ghi"
        
        a:
         b:
             - c
             - d
             -  e
        f:
            "ghi"
        
        • zero_spelled_with_an_ecks@programming.dev
          link
          fedilink
          arrow-up
          1
          arrow-down
          1
          ·
          4 months ago

          So it’s easy to enforce locally but you don’t have to. And it’s easy to see indentation on modern IDEs and you can even make your indents rainbows and collapse structures to make it easier to see what’s going on, but I guess since some people want to write it in vi without ALE or a barebones text editor, it’s bad? Like there are legit reasons it’s bad, and other people have mentioned them throughout the thread, but this seems like a pretty easy thing to deal with. I work with ansible a bunch and YAML rarely is where my problem is.

          • atzanteol@sh.itjust.works
            link
            fedilink
            English
            arrow-up
            6
            ·
            4 months ago

            Jesus, just what I want to do with the devops team - spend a few weeks standardizing on an editor and configuring them to edit yaml.

    • atzanteol@sh.itjust.works
      link
      fedilink
      English
      arrow-up
      3
      arrow-down
      2
      ·
      edit-2
      4 months ago

      YAML mixes 2 and 4 spaces all the time. Python scripts don’t run if you write this kind of crap.

      Sure it does. You only need to be consistent within a block. Python’s syntax is ridiculous and solves problems that basically don’t exist.

      All of my java/kotlin/rust/etc. code is trivially well formatted and can be done by my editor. Moving code blocks is trivial. Refactoring is easier when I didn’t need to hand -format the code just to make it work.