Live data from Hacker News

That's a Lot of YAML

noyaml.com

31–40 of 57 posts

Re: That's a Lot of YAML

#31

Yaml is the language nobody needed. All we wanted was a better JSON format that supports comments and doesn’t crash with an extra comma as the end of a list, eg: [1,2,3,]

Trailing commas for sure, but I buy the argument that comments would be used to sneak in arbitrary directives and break interoperability. In fact, I’d like to see a less featureful JSON where everything is strings. Trivial parsing, leave interpretation up to the receiver.

Comments by themselves provide enough value to justify their supports.

Plus non standard stuff is not a valid argument. As there are many tools which support non standard behaviour, because useful features like comment are considered non standard

Re: That's a Lot of YAML

#32
post #20

Earlier quoted context omitted.

Trailing commas for sure, but I buy the argument that comments would be used to sneak in arbitrary directives and break interoperability. In fact, I’d like to see a less featureful JSON where everything is strings. Trivial parsing, leave interpretation up to the receiver.

For a configuration language, comments are absolutely crucial. You want to be able to say "# This option is set because " to explain why you are configuring it this way to the next person that reads the code (or you, in the future). If the price to pay is that there is some risk some dummy might start parsing the comments as code, so be it. This is not a really a problem in "regular" programming languages, I don't se…

I will start by saying, I completely agree with you!

But, then, I have to behave like a typical computer nerd and say..

Well ackchuallyyyyyy:

  > "This is not a really a problem in "regular" programming languages"
Browsers do stupid:

Linux does stupid: #!/bin/bash

C/C++ (preprocessor marcos) do stupid: #ifdef

https://en.wikipedia.org/wiki/Conditional_comment

https://en.wikipedia.org/wiki/Comment_(computer_programming)

Re: That's a Lot of YAML

#33
post #13
post #11

Yeah theres some problem, but reading a multiline code block (like github actions bash script) as an indent-escaped string is so much better than having to understand crazy triple-escaped characters like "sed \"\\\\\\"name1\\\\\\\"\""

What's even better is just using an actual programming language. Not bash, not sed, not yaml. Just python or NodeJS.

you only think until you have to extract some information from it. "Here is a dir full of CI job definitions, find all the ones which require extra permissions" - trivial in yaml or json or toml, could be hard to impossible for Python/nodejs.

or "I am doing ci job frontend, for each job I need to get a list of inputs it takes and their description, but without doing full code checkout" - good luck doing this if your jobs are in python/nodejs.

(to be fair, there are programming languages that are also severely limited and can be evaluated mostly safely, like Starlark, but I don't think they'd match your definition)

Re: That's a Lot of YAML

#34
I'm a big fan of YAML after coming from JSON and, later, ProtoBuf's many definition formats while working at Google---but it's true that there are a lot of oddities in YAML's magical parsing. I'm grateful for the many ways it's possible to quickly an naturally define simple hierarchies of data (for example, in a docker-compose file).

This website does the rare thing of, after complaining, providing a long list of alternatives. It's really nice.

Re: That's a Lot of YAML

#38

I will die on the hill that TOML should be used for the vast majority of what YAML's used for today. There are times a full language is needed, but I've seen so many YAML files that use none of the features YAML has with all of the footguns.

But toml isn't any better than yaml. It's difficult to read

Re: That's a Lot of YAML

#39

I will die on the hill that TOML should be used for the vast majority of what YAML's used for today. There are times a full language is needed, but I've seen so many YAML files that use none of the features YAML has with all of the footguns.

TOML is worse and even harder to read. I'd take YAML any day over TOML.
Post reply on HN