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?

  • thingsiplay@beehaw.org
    link
    fedilink
    arrow-up
    0
    ·
    13 days ago

    I don’t like it either, but I’m not entirely sure why. Maybe the biggest flaw to me is it uses Python style indentation for structuring as part of data logic. It doesn’t feel like a configuration language to me and it does not feel simple too. It’s also unlike most programming language structures (maybe besides Python), so it looks weird to read and write. Other than that, I don’t know exactly why I don’t like this format much. Admittedly, I did not do much in YAML, so because lack of experience take my opinion with a thick grain of salt.

    We have JSON and TOML. I quiet like TOML. We have “better” alternatives, that are probably easier to parse. And therefore there is not much need for YAML. Maybe if YAML was the default config format for Python it would get off the ground and be accepted more often.

  • lehenry@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    13 days ago

    I think TOML should replace YAML for config files, it is much clearer, easier to parse for a human.

    • NostraDavid@programming.dev
      link
      fedilink
      arrow-up
      0
      ·
      12 days ago

      Depends on the data structure. If you want to save a table of sorts, you’re getting a bunch of unreadable [[[]]] nonsense.

      For flat structures it’s great though.

  • magic_lobster_party@fedia.io
    link
    fedilink
    arrow-up
    0
    ·
    13 days ago

    I don’t like YAML because it’s overly complicated. The specification is like 80 pages long. How the hell did they think that was a good idea?

    JSON on the other hand is super simple. It doesn’t do more than it needs to.

    Just compare this: https://yaml.org/spec/1.2.2/

    With this: https://www.json.org/json-en.html

    The entire JSON specification is shorter than just the table of contents of the YAML specification!

    Another thing I like about JSON is that you can format it however you want with the whitespace. Want everything on one line? Just write everything on one line!

    If data can be represented as a JSON, then there’s generally only one way to represent it in JSON (apart from whitespace). In YAML the same data can be represented in 1000s of different ways. You pick one.

    • lemmyng@lemmy.ca
      link
      fedilink
      English
      arrow-up
      0
      ·
      13 days ago

      I will never forgive JSON for not allowing commas after the last element in a list.

    • verstra@programming.dev
      link
      fedilink
      arrow-up
      0
      ·
      13 days ago

      This is the major reason for me. I really liked yaml, because it is way more readable to me than JSON. But then I kept finding new and more confusing yaml features and have realized how over-engineered it is.

      Yaml would be great language if it had its features prunned heavy.

  • GTG3000@programming.dev
    link
    fedilink
    arrow-up
    0
    ·
    12 days ago

    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.

  • Vivendi@lemmy.zip
    link
    fedilink
    arrow-up
    0
    ·
    edit-2
    13 days ago

    Can people stop hating on shit?

    FOR FUCKS SAKE, negative reinforcement dopamine has RUINED THE FUCKING NET.

    EVERYWHERE I GO there’s someone bitching about something, hate circlejerks are unbelievably popular, people just love to hate on stuff.

    You’re ruining your thought patterns with all these social media negativity bullshit.

    Fucking TOML users hate on fucking YAML fucking C++ users hate Rust fucking Rust users hate literally everything under the sun and are insufferable to work with

    EVERYONE, fucking CHILL

    • Sir Gareth@programming.dev
      link
      fedilink
      arrow-up
      0
      ·
      12 days ago

      Yeah TBH I like yaml. Sure its not the best ever, but its not the worst it could possibly be.

      For config its not terrible. For ansible playbooks its again… not terrible.

      Why is everyone always hating on something which is just kinda mid.

      • wewbull@feddit.uk
        link
        fedilink
        English
        arrow-up
        0
        ·
        12 days ago

        Config is fine, but Yamls biggest problem is people use it to describe programs. For example: playbooks. For example: CI steps.

        If YAML wasn’t abused in this way it would have a lot less hate.

        • derpgon@programming.dev
          link
          fedilink
          arrow-up
          0
          ·
          12 days ago

          What’s wrong with using YAML for CI? I mean, I use it for Gitlab CI, the underlying script it runs is just Bash.

          • cashew@lemmy.world
            link
            fedilink
            arrow-up
            0
            ·
            12 days ago

            You’re doing it right by avoiding as much of Gitlab’s CI features. I’ve seen versions where scripts are inlined in the YAML with expressions in random rule fields and pipeline variables thrown all over the place. And don’t get me started on their “includes” keyword, it’s awful in practice, gives me nightmares.

            Then I write a Kubernetes manifest in YAML with JSON schema validation and the heart rate goes down again.

          • wewbull@feddit.uk
            link
            fedilink
            English
            arrow-up
            0
            ·
            12 days ago

            Right, so you just have a single step and then hand over to a proper script. I’ve seen many people try to put much more complex logic in there before handing over to a proper language.

      • SandLight@lemmy.world
        link
        fedilink
        English
        arrow-up
        0
        ·
        12 days ago

        I dream of a life where I use YAML but all my configs are stuck in XML. People can complain but there’s always worse options.

        • FizzyOrange@programming.dev
          link
          fedilink
          arrow-up
          0
          ·
          12 days ago

          One nice thing about XML is that there’s an official way to link to the schema from within the document. If you do that you can easily automatically validate it, and even better you get fantastic IDE support via Red Hat’s LSP server. Live validation, hover for keys, etc.

          It’s a really nice experience and JSON schema can’t really match it.

          That said, XML just has the wrong data model for 99% of use cases.

    • orcrist@lemm.ee
      link
      fedilink
      arrow-up
      0
      ·
      12 days ago

      No seeds no stems no stress my guy. The Internet is a great place for complaining. Readers can downvote and move on, everyone gets what they want.

  • LyD@lemmy.ca
    link
    fedilink
    arrow-up
    0
    ·
    12 days ago

    YAML works great for small config files, or situations where your configuration is fully declarative. Go look at the Kubernetes API with its resources.

    People think YAML sucks because everyone loves creating spaghetti config/templates with it.

    One reason it tends to become an absolute unholy mess is because people work around the declarative nature of those APIs by shoving imperative code into it. Think complicated Helm charts with little snippets of logic and code all over the place. It just isn’t really made for doing that.

    It also forces your brain to switch back and forth between the two different paradigms. It doesn’t just become hard to read, it becomes hard to reason about.

  • MajorHavoc@programming.dev
    link
    fedilink
    arrow-up
    0
    ·
    13 days ago

    If YAML and JSON were gripping my hands for dear life, dangling off of a cliff…

    I would let both drop into the abyss so I could spend more time with INI.

  • Damage@feddit.it
    link
    fedilink
    arrow-up
    0
    ·
    13 days ago

    I think much of the issue with YAML is that it’s often paired with bad editors. You need a way to manage the whitespace, collapse sections, etc. Notepad doesn’t cut it.

  • ulkesh@beehaw.org
    link
    fedilink
    English
    arrow-up
    0
    ·
    12 days ago

    White space/indentation as a construct of the syntax.

    It’s why I have a hard time with python.

    People have their likes and dislikes. Nothing wrong with that.

  • corsicanguppy@lemmy.ca
    link
    fedilink
    English
    arrow-up
    0
    ·
    11 days ago

    We all know it sucks. I have no idea why people use it instead of anything else. My workday is jammed with fucking ansible which, while also being so ghetto that we were easily doing more with less in 2002, uses So.much.fucking.yaml . Just when you think ansible couldn’t get more clunky and useless and slow, it also is configured in yaml.

  • Reddfugee42@lemmy.world
    link
    fedilink
    English
    arrow-up
    0
    ·
    12 days ago

    I don’t like a thing, fellas. With that being all I’ve told you, please explain why I don’t like that thing.

  • talkingpumpkin@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    12 days ago

    Yaml is fundamentally the same as the json and xml it has mostly replaced (and the toml that didn’t manage to replace yaml)… it’s a data serialization format and just doesn’t have any facility for making abstractions, which are the main tool we human use to deal with complexity.

    • lolcatnip@reddthat.com
      link
      fedilink
      English
      arrow-up
      0
      ·
      12 days ago

      JSON and YAML aren’t the same as XML. The attribute/child distinction in XML, and the fact that every object has a tag name associated with it, make it a PITA to map into the data primitives of any programming language I know.