loading...

Discussion on: Stop Using YAML

Collapse
jeffhykin profile image
Jeff Hykin

If YAML is being human typed, it seems like mistakes (like the & for powershell) would be fairly obvious thanks to syntax highlighting. Many languages have built in keywords/symbols, and users can avoid using keywords as variable names because they are highlighted as soon as they are typed. I use this method especially when using a language I'm not familiar with.

The same argument could be made for PowerShell itself. If I am using cd and the path includes a & (or one of several other special characters) quotes are needed, just like YAML. Maybe you would also criticize PowerShell for this as well, I'm not sure.

If you're ever concerned about ambiguity, just always use quotes. I would argue that English is the root of ambiguity, and whenever a language is made Grandma-readable it necessarily must introduce ambiguity.

It seems a little unfair to say to stop using YAML, but not offer a clear alternative.

I don't think YAML is without fault, but many issues like machine editablity (while preserving comments) were not brought up.

I'm not sure what you mean about whitespace only lacking meaning inside of lists. If you could explain that further.

I'm also not sure what you mean about the JSON reference conversation. If you could explain that a bit as well.

Collapse
jessekphillips profile image
Jesse Phillips Author

If you're ever concerned about ambiguity, just always use quotes.

But that is exactly what I hate. Now I must arbitrarily give advice to always quote or learn the many ways yaml will bite you.

Lists can either be indented, or reside at the same level as their parent.

People use "$ref" : by convention in json in order to use references.

I did not make an alternate recommendation because their are so many out there. Yes having to learn 20 configuration languages over yaml probably isn't worth it

You mentioned machine readable (preserving comments). I don't see this usage. In fact I don't think I've seen it where the machine writes yaml, only humans.

Collapse
jeffhykin profile image
Jeff Hykin

But that is exactly what I hate.

Do you hate this about PowerShell and Bash as well?

I don't think I've seen it where the machine writes yaml

That's because it doesn't work well. References are processed on load/import and that breaks the export, comments are destroyed, the style (quoted or unquoted) is ignored, etc. PyYaml is the only one with debatable support for comment preservation and it has plenty of problems. This is one of the weaknesses of YAML, and why it is a problematic replacement for many setup config files like the package.json.

Thanks for the clarifications, they make sense now.

However, I'm now confused why you would title this "Stop Using YAML" if you still think YAML is better than learning 20 different configuration languages.

Thread Thread
jessekphillips profile image
Jesse Phillips Author

Yaml advertising itself as human friendly, then having the same complexity as bash... Bash and powershell don't do that.

It is interesting that you list problems with yaml others are saying it does well... Hmmm...

Thread Thread
jeffhykin profile image
Jeff Hykin

Maybe another comment has mentioned this, but you might like StrictYAML. It is a subset of YAML designed specifically to weed out all ambiguity. It might even be the solution you want to suggest as an alternative to YAML.

I can understand where you're coming from with Bash and PowerShell. Learning by mistakes was painful and very confusing in Bash, and I honestly think shell languages need a complete redesign. Funny enough is I actually made an experimental shell to address this by having it accept all arguments in the form of YAML to reduce ambiguity.

I love YAML, but I don't want to pretend that it doesn't have serious flaws. Which is why I mention the problems that it has. I really want it to completely replace JSON, but it is going to need improvements before that is realistic.

For me personally, if it is humans writing YAML with syntax highlighting enabled, I think YAML is the gold standard for config files.

Thread Thread
realquadrant profile image
timfong888

Hi i am working on the StackStorm open source project to automate some dev opsy things and the workflows are built in YAML. It is himan readable but brittle. But have been wondering if its the best way to define workflows which may be more dynamic and can be better expressed differnetly, such as ith bitwise operators.

So am interested in alternatives without throwing out the baby wih the bathwater. So curious about strictYAML.

But since a workflow ideally has programmability and graph attributes, what other alts are there?

Thread Thread
jessekphillips profile image
Jesse Phillips Author

I don't have vast experience with different alternatives. I think one of the big challenges often faced is you want something readily available in multiple languages.

I really like Lua. Not as a programming language, but the lightweight embedded part. They keeped the syntax light, but don't go overboard like yaml.