Live data from Hacker News

In Defense of YAML

blog.atomist.com

11–20 of 173 posts

Re: In Defense of YAML

#12
Something I've never liked about YAML, and I've not found a way around, is that you can't know if you have the entire file because there isn't an end marker. If someone cut'n'pastes a block of YAML you don't know if they missed a bit off the end by mistake (unless you know the schema). That makes it harder to debug problems with YAML config.

Re: In Defense of YAML

#14
post #8

You want to see a real abuse of YAML? Take a look at SaltStack's Jinja rendered YAML. I just grabbed a random forumla as an example: https://github.com/saltstack-formulas/openssh-formula/blob/m...

I don't understand why people use a markup language when they need a programming language. I mean, sure, you can convert one into the other syntax-wise, both form trees, but what do you gain?

Because the tools only support markup languages, so we have to use stuff like Jinja or go templates to create those.

Re: In Defense of YAML

#15
You can actually use Python as a configuration file pretty well, if you need more complicated logic and macros. Otherwise, sticking to a toml or ini file is my preference.

Re: In Defense of YAML

#16
post #9

Earlier quoted context omitted.

What about https://dhall-lang.org/ ?

Dhall does indeed look like it starts to address this problem - haven't seen it before. I'd have to read deeper to decide whether I like it or not, though. I may try to convert some existing complex YAML I'm using into it to form an opinion.

Dhall is nice that it can natively support configuration migrations via total functions. For example Config1 can be migrated to Config2 by applying a function that always completes. It's also possible to constrain that function so it must accept Config1 and return Config2.

Dhall supports functions from URLs and it's good to pin them using SHA hashes of their internal representation.

Re: In Defense of YAML

#17

You want to see a real abuse of YAML? Take a look at SaltStack's Jinja rendered YAML. I just grabbed a random forumla as an example: https://github.com/saltstack-formulas/openssh-formula/blob/m...

Where's the abuse? They're just generating a YAML with Jinja2. Is there something egregious about their YAML structure?

Re: In Defense of YAML

#18
post #12

Something I've never liked about YAML, and I've not found a way around, is that you can't know if you have the entire file because there isn't an end marker. If someone cut'n'pastes a block of YAML you don't know if they missed a bit off the end by mistake (unless you know the schema). That makes it harder to debug problems with YAML config.

You could make a convention where the file has to end with a document separator, i.e.

  ---
But depending on the exact setup and used YAML parser, this may be hard to enforce.

Re: In Defense of YAML

#19
post #2

> Note the script block containing a list of shell scripts. Does this look like data? Code is Data! Lisp-it or Quit!

One of these days, I want to come up with a non Turing complete s-expression based config format (basically something like a Lispy JSON) and post it here just to watch Lispers rage at not being able to write DSLs in it.

Re: In Defense of YAML

#20

The YAML spec requiring turning "yes" "1" to true, and "no" "0" to false is one of the most aggravating things about YAML.

Yeah, they probably should have had special syntax for booleans.

The problem is that they have too much special syntax for booleans.
Post reply on HN