Live data from Hacker News

That's a Lot of YAML

noyaml.com

21–30 of 57 posts

Re: That's a Lot of YAML

#21
post #7

Earlier quoted context omitted.

This site's mobile experience mirrors my feelings when having to edit deeply nested and templated YAML.

Is editing deeply nested JSON and XML a better experience than YAML? I don't think so.

I’d argue yes, strictly due to the lack of significant whitespace.

Re: That's a Lot of YAML

#22
post #10

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,]

I want multiline strings and references

Have you considered XML?

Re: That's a Lot of YAML

#23
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…

> This is not a really a problem in "regular" programming languages

https://go.dev/wiki/Comments#directives :-D

Re: That's a Lot of YAML

#24
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.

This is the same debate folks have between Maven and Gradle: do you want CI code to be able to do *anything* that Python or Node can do, or do you want well defined knobs people can turn. If nothing else, it makes code reviews for CI way less drama than trying to use some bespoke dsl-in-python that re-implements {job: {steps: [{run: ...}]}} in a less legible way

Re: That's a Lot of YAML

#25

When it comes to AWS Cloudformation, I love YAML. Can't think of any other positive use though.

They should be beaten about the head and shoulders for how atrocious this is: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGui...

Also, due to it failing to work as advertised, I just use `cfn-lint --info -e` to grab the transformed template and use that for realz.

Re: That's a Lot of YAML

#26
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.

Re: That's a Lot of YAML

#27
post #18

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,]

JSON5 is exactly what you're looking for and has somewhat decent adoption. I use it for configuration on one of my projects and I really enjoy it.

Does it support float NaNs? Only asking because of Python's quirky non-standard implementation

Re: That's a Lot of YAML

#28
post #12

I can take credit for one of these, the 63 ways to wrap a string, on line 156.

That's what https://yaml-multiline.info is for! I know the author's on HN, I hope they chime in here :)

Amusingly, the Stack Overflow answer you linked in your contribution is the second result in a Google search for "YAML multiline string" or the like, after yaml-multiline.info; the two combined appear to the canonical resource on the web.

Re: That's a Lot of YAML

#29
YAML's idea of human readability misses the mark. Especially anchors. They're the worst tools for abstraction.

JSON with functions as the high level format and JSON as the low level format is the way to go. Examples include Nix and Jsonnet. They're much nicer to deal with and less error prone.

Re: That's a Lot of YAML

#30
post #23
post #20

Earlier quoted context omitted.

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…

> This is not a really a problem in "regular" programming languages https://go.dev/wiki/Comments#directives :-D

They said "regular" programming languages
Post reply on HN