DEV Community

Discussion on: Stop Using YAML

Collapse
 
therealkevinard profile image
Kevin Ard • Edited

The rise of yaml is the rise of golang. The tools we know yaml from - the dockers, the kubernetes, the so on and so forths - are largely written in golang.

In go world, yaml is trivial to parse. By trivial, I mean: no trouble whatsoever. Go's struct tags, along with marshal/unmarshal, made config parsing a non-problem. In a world where parsing concerns are non-existent on the code side, we naturally err towards DX on the human side.

This doesn't necessarily hold true in Node, Python, or other languages, but - again - yaml's rise is go's rise.


Edit: I processed this little bit

Powershell uses & for file execution and YAML uses it for anchors

This hints more at established languages like C and Go. Ampersand is the traditional syntax for a pointer. Generally speaking, the people who write lang specs aren't going to give too much weight to what powershell does.


Edit: some additions.

  • With Go: every time, I use yaml (for legibility)
  • With Node: Every time, I use JSON (for support).
  • With interop between the two: I lean towards json.
  • In all cases: I wish json was more human-friendly.
Collapse
 
jessekphillips profile image
Jesse Phillips

Xml is trivial to parse, and by that I mean someone wrote a lex and parsers so you don't have to.

The majority of my argument was related to the human need to understand the intricacies of the language, but you only focus on the machine aspect in your rebuttal, why?

Collapse
 
therealkevinard profile image
Kevin Ard

We play a fine line between person and machine. More often than not, the machines win.

If anything, I played the middle ground - the "humans and machines can get along now" side of things.

Really, though, it's purely objective:

  • the tools that have made yaml ubiquitous are written in Go.
  • Go has struct tags and marshaling.
  • Why marshal to json when you can marshal to yaml with zero effort?
  • such is yaml.

When go dies, yaml will die.
Maybe?

Thread Thread
 
arnauldvm profile image
Arnauld Van Muysewinkel

Not only Go is a friend of YAML. It happens that Python syntax shares several similarities with YAML, and using YAML is very natural to a Python programmer. Go may die, YAML will survive add long as Python does ;-).