Live data from Hacker News

Why are we templating YAML?

leebriggs.co.uk

1–10 of 351 posts

Re: Why are we templating YAML?

#3
I think they are missing the real selling point of JSON. It's basically interoperable with JavaScript objects.

That means you write it, send it, store it, operate on it, etc. with little or no modification.

The author says "converting between the two is trivial" which may be true, but the developer overhead is less trivial. And it will always be JSON in the client - JS doesn't support YAML objects.

Re: Why are we templating YAML?

#4

The real question is why are we using yaml at all?

Baffles me. I don't like any language or file format where whitespace matters. Even Haskell bothers me in this regard. To me white space shouldn't add cognitive load. I want to look at the symbols not the formatting of the antisymbols to understand what is going on.

Write JSON and use your editor tools to format it with nice indentation, and you are sweet!

That said Yaml makes an excellent format for reading, but not for writing.

Re: Why are we templating YAML?

#5

The real question is why are we using yaml at all?

I've taken the strategy of emitting JSON, but accepting YAML input (maybe a restricted subset in cases where it's untrusted data). YAML can function as a super-set of JSON, so you can have comments in hand-written/modified data this way while emitting a simpler to parse data format.

Re: Why are we templating YAML?

#6

I think they are missing the real selling point of JSON. It's basically interoperable with JavaScript objects. That means you write it, send it, store it, operate on it, etc. with little or no modification. The author says "converting between the two is trivial" which may be true, but the developer overhead is less trivial. And it will always be JSON in the client - JS doesn't support YAML objects.

Except that you cannot encode pretty valid Double.NaN or Date(), which is showstopper for many.

I remember mongodb started with json, but switched to in-house bson pretty early because of the json limitations.

Re: Why are we templating YAML?

#8

The real question is why are we using yaml at all?

Baffles me. I don't like any language or file format where whitespace matters. Even Haskell bothers me in this regard. To me white space shouldn't add cognitive load. I want to look at the symbols not the formatting of the antisymbols to understand what is going on. Write JSON and use your editor tools to format it with nice indentation, and you are sweet! That said Yaml makes an excellent format for reading, but not…

White space matters with Python but I rarely run into issues with indentation in Python. But YAML on the other hand, I have nothing but nightmares.

Re: Why are we templating YAML?

#9

I think they are missing the real selling point of JSON. It's basically interoperable with JavaScript objects. That means you write it, send it, store it, operate on it, etc. with little or no modification. The author says "converting between the two is trivial" which may be true, but the developer overhead is less trivial. And it will always be JSON in the client - JS doesn't support YAML objects.

[deleted]

Re: Why are we templating YAML?

#10

The real question is why are we using yaml at all?

It's a lot easier for end-users to read and write by hand. If that is not a requirement, a simpler machine-friendly format is likely better.

Writing YAML is not easy for end-users. The indentation--especially in large files--is really difficult to keep track of, and some really basic stuff like when to quote strings is not consistent at all.
Post reply on HN