Live data from Hacker News

YAML: Probably not so great after all

arp242.net

401–410 of 457 posts

Re: YAML: Probably not so great after all

#401

From my experience, while YAML itself is something one can learn to live with, the true horror starts when people start using text template engines to generate YAML. Like it's done in Helm charts, for example, https://github.com/helm/charts/blob/master/stable/grafana/te... Aren't these "indent" filters beautiful?

Some templating languages such as Jsonnet[0] add built-in templating and just enough programmability to cover basic operations like templating and iteration.

I originally felt it was overly complex, but after seeing some of the Go text/template and Ansible Jinja examples in the wild, it actually seems like a good idea.

Perhaps we should more strongly distinguish between “basic” data definition formats and ones that need to be templated. JSON5 for the former and Jsonnet for the latter, for example.

Re: YAML: Probably not so great after all

#402
post #235

Earlier quoted context omitted.

Code you write yourself is not usually the source of problems with significant whitespace; it's situations like posting code on websites and discussing it where code in a whitespace-significant language becomes next-to-useless when leading whitespace is stripped, whereas code in any other language will still survive and then easily be autoformatted without changing its meaning.

Can’t remember the last time this has actually happened to me. In what websites are people posting code without code block formatting support? Like, instant messengers?

Funfact, even Facebook, Whatsapp, and Telegram support preformatted text in triple backticks.

Re: YAML: Probably not so great after all

#403

Earlier quoted context omitted.

I've never understood this. JSON is really not that difficult to work with manually. I tend to write my config files as JSON for utilities I write. What is it with peoples' innate aversion to braces?

I don't aversion to braces. Rather, my issues with JSON is that it doesn't have comments and that you cannot use a optional trailing comma.

Also no multiline strings. Using \n or string arrays is painful.

I don't get why TOML is so underrated, it's barely mentioned in the HN discussion

Re: YAML: Probably not so great after all

#404
post #392
post #288

Earlier quoted context omitted.

And the required double quotes around strings. YAML’s string handling is a lot easier to deal with.

It’s easier until you hit one of the cases where a particular value is interpreted as a different type, possibly in a very confusing context. I’ve seen that bite enough people that I end up quoting strings to avoid confusion.

It’s also extremely hard to learn as a beginner.

“Hey, I deleted a character in a string and now I am getting this weird schema validation exception”.

Re: YAML: Probably not so great after all

#405

Earlier quoted context omitted.

Any more so than the rest of your code?

Config files are typically written updated by non-developers and often go through a less rigorous release process, so having a less-complex and dangerous, even if less-capable, language can be desirable.

Ah, that's not been my experience - but I can understand that if non-developers are the ones making the changes

Re: YAML: Probably not so great after all

#406
post #392

Earlier quoted context omitted.

It’s easier until you hit one of the cases where a particular value is interpreted as a different type, possibly in a very confusing context. I’ve seen that bite enough people that I end up quoting strings to avoid confusion.

It’s also extremely hard to learn as a beginner. “Hey, I deleted a character in a string and now I am getting this weird schema validation exception”.

Or “Why did it break when I changed the version from 3.7 to 3.7.1?”

Re: YAML: Probably not so great after all

#407
post #315

Earlier quoted context omitted.

An encoder is anything that serializes some data. Think `JSON.stringify()`.

YMMV, I believe most folks would call that "serialization," reserving "encoding" for turning a notionally written-down-ish representation into bytes; e.g. string -> utf8 bytes, or float -> IEEE-754 bytes.

I've seen it used even more generally for any `A -> B` (or `A -> Option`) where B could be faithfully decoded back to A.

In my head, serialization is a special case of encoding when B is some type of string. In this case it's YAML.

I could probably have worded my previous comment more precisely.

Re: YAML: Probably not so great after all

#408
post #403

Earlier quoted context omitted.

I don't aversion to braces. Rather, my issues with JSON is that it doesn't have comments and that you cannot use a optional trailing comma.

Also no multiline strings. Using \n or string arrays is painful. I don't get why TOML is so underrated, it's barely mentioned in the HN discussion

Thanks for mentioning it; I hadn't encountered it yet and it seems like a very sane config file format. There's several mentions in this discussion actually, nearly all positive.

Re: YAML: Probably not so great after all

#409
post #288

Earlier quoted context omitted.

I don't aversion to braces. Rather, my issues with JSON is that it doesn't have comments and that you cannot use a optional trailing comma.

And the required double quotes around strings. YAML’s string handling is a lot easier to deal with.

I think it is good to require quotation marks for strings, at least for values (although I could live with it if quotation marks for strings are allowed even if not required, since then, if you do not like the feature of not having quotation marks for strings, you can just not use that feature).

Maybe it would be sense if quotation marks were not required for keys with only a restricted character set which are not an empty string, though.

Re: YAML: Probably not so great after all

#410

Earlier quoted context omitted.

What if it's to be used by french speaking software/people ? Or Dehors Außenseite Outside Quite curious about it.

I guess this way: Dehors Draußen Outside says[0]the w3. [0] https://www.w3.org/TR/REC-xml/#sec-lang-tag

I see, thanks. (I also see you corrected my broken German ^^).
Post reply on HN