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?

You are viewing a single thread.
View all comments

It sucks the same way Python sucks. Some people just really donโ€™t like indentation-based syntax. Iโ€™m one of them, so I dislike both formats. However, if you groove on that sort of thing, I donโ€™t think YAML is any worse than any other markup.

Oddly, I get along with Haskell, which also used indentation for scoping/delimiting; I canโ€™t explain that, except that, somehow, indentation-based syntax seems to fit better with functional languages. But I have no clear argument about why; itโ€™s just an oddity in my aesthetics.

permalink
report
reply
11 points
*

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โ€ฆ

permalink
report
parent
reply

YAML mixes 2 and 4 spaces

I think thatโ€™s a user thing and it doesnโ€™t happen if you have a linter enforce 2 or 4.

permalink
report
parent
reply
8 points
*

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"
permalink
report
parent
reply
2 points
*

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.

permalink
report
parent
reply
1 point
*
Deleted by creator
permalink
report
parent
reply

Programming

!programming@programming.dev

Create post

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another personโ€™s post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If youโ€™re posting long videos try to add in some form of tldr for those who donโ€™t want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



Community stats

  • 2.2K

    Monthly active users

  • 1.8K

    Posts

  • 29K

    Comments