No: Body: Wants: To: Write: – YAML
noyaml.com
noyaml.com
No:
Body:
Wants:
To:
Write:
- YAML
vs. <No>
<Body>
<Wants>
<To>
<Write>
<item>YAML</item>
</Write>
</To>
</Wants>
</Body>
</No>
vs. {
"no" : {
"body" : {
"wants" : {
"to" : {
"write" : [ "YAML" ]
}
}
}
}
}
Which would you rather write?JSON is not bad to write by hand. Simple XML isn't too bad either, but I still prefer JSON.
Neither does the YAML one? So?
you’re forcing them all to have the same indentation
I don’t know about you, but I always pretty-print JSON, just like I always indent my code no matter which language I’m using.
In fact that’s one of the arguments in favour of significant whitespace -- you’re going to be indenting anyway, so why bother with the brackets? It’s not an argument everyone buys, but everyone still indents their code.
Because brackets are explicit. Whitespace is implicit and difficult to distinguish without editor support.
More seriously, the earlier comment complained that the indentation for the non-significant-whitespace examples was artificial. I’m saying it’s not artificial because in practice you would indent it.
> Because brackets are explicit. Whitespace is implicit and difficult to distinguish without editor support.
I'm with parent on this one. Most people who complain about python's reliance on indentation still indent their code, and rely on the visual & editor hints (ie. they're profoundly confused when they muck up their indentation, but their brackets are still correct).
But I digress.
Whitespace is explicit in some (markup) languages, and there's nothing *plicitly wrong with that. If you're trying to do any kind of editing of a (markup) language that relies on sensible indentation with an editor that doesn't understand whitespace then you've probably got bigger problems.
Whitespace is never explicit. It only exists as the gap between other characters. You only perceive its absence.
> If you're trying to do any kind of editing of a (markup) language that relies on sensible indentation with an editor that doesn't understand whitespace then you've probably got bigger problems.
Which is why they should not be used for configuration files.
nobody.wants.to.write = [ "YAML" ] # I guess you could put ["YAML"] if you need it as an array and not a string
no.body.wants.to.write=YAML
Easy to type, is on a single line, only breaks once you're so many layers deep that you need to scroll horizontally - but let's be real - if that happens the config isn't the problem but why is your program so complex? is the problem.Drawbacks of this are when the program is inconsistent. Was it `nobody.wants.to.write` or `no.body.wants.to.write`? Or alternatively, why is it `nobody.wants.to.read` but `no.body.wants.to.write`?
Made me think there's also a big difference in what nobody prefers reading vs. what nobody prefers writing.
Here's an interesting example of using bencode which is the object format for BitTorrent:
curl -sL https://cdimage.debian.org/debian-cd/current/amd64/bt-cd/debian-9.4.0-amd64-netinst.iso.torrent | faq -f bencode 'del(.info.pieces)' -o json
{
"announce": "http://bttracker.debian.org:6969/announce",
"comment": "\"Debian CD from cdimage.debian.org\"",
"creation date": 1520682848,
"httpseeds": [
"https://cdimage.debian.org/cdimage/release/9.4.0//srv/cdbuilder.debian.org/dst/deb-cd/weekly-builds/amd64/iso-cd/debian-9.4.0-amd64-netinst.iso",
"https://cdimage.debian.org/cdimage/archive/9.4.0//srv/cdbuilder.debian.org/dst/deb-cd/weekly-builds/amd64/iso-cd/debian-9.4.0-amd64-netinst.iso"
],
"info": {
"length": 305135616,
"name": "debian-9.4.0-amd64-netinst.iso",
"piece length": 262144
}
}Xml is fine. Json is fine. Yaml is fine. Yes, they have warts. That's fine too.
I do still use YAML on the rare occasion where i just don't like how the TOML ends up looking[1]. My plan with that example is to eventually make a more simplist DSL that can handle the usecase, but my first attempts didn't produce anything I liked.
[1] https://github.com/perlbot/App-EvalServerAdvanced/blob/maste...
Preference is preference. Stop acting like it's not. This page might have been "Nobody wants to use VI" or "Nobody wants to use Emacs" or "Nobody wants to use [insert thing I hate here]"
Kubernetes...devops tooling...CloudFormation?
You better <3 YAML.
FWIW CloudFormation added YAML, which was a vast improvement to usability IMO over where they started. Want CloudFormation to support something else? Lobby through your AWS account rep for what you want supported.
I looked, but target URL didn't spell it out, and I lack sufficient domain knowledge to dive into the repo to find it -- but I'm curious as to how big, and indeed how complex, those 10 structs are.
It seems disingenuous to swap units mid-sentence when comparing size or complexity.
My gut feel is the set of people who could understand thoughtfully designed YAML should be larger than the set of people who could understand thoughtfully designed structs (+ wrappers?).
Scroll to the bottom:
In a nutshell, they got rid of a custom programming language they had inadvertently created via YAML and text/template. Their YAML models were effectively written in a Turing-complete language composed of YAML and text/template directives. They had been heavily abusing the FuncMap type in text/template.
I got to https://github.com/kubernetes/kops ... and that's where I got out of my depth.
It sounds like it wasn't a problem with YAML per se, but their misappropriation of text/template and wrangling YAML to be something other than a configuration tool. It feels similar to if I were to complain about the shortcomings & complexity of the jinja2 constructs I make within my YAML.
> This means that, in theory at least, a YAML parser can understand JSON
Does anyone have experience with this? It seems counter-intuitive at first, but Google agrees, and I don't know enough about parsers to say it's wrong. Can you really feed pretty much any JSON file into a YAML parser and get back a valid and correct, properly formed data structure?
https://tinyurl.com/lessons-in-over-engineering and https://twitter.com/ellism/status/1008728148131733504
I accept accessibility PRs. Mash the octocat.
I don’t need a “thought” emoji to read your first line, I don’t need the finger pointers to see where I should read next, it’s condescending and terribly ugly.
PS: I accept PRs to make it work better on mobile including accessibility. Send PRs.
That said, I'm partial to s-expressions and TOML nowadays.
I am really beginning to hate programmer-centric tooling. It has turned all of us into these miserable, cretinous engineering snobs. It seems impossible for anyone to contemplate why people would choose to work differently than them. Zero empathy. Fucking pathetic.
Make software hard again, I say. Treat the compiler like you would treat your dominatrix. Life would be so much better that way!
Ever use borgcfg?
The second hit is a google+ post wailing “arrrrgh, somebody reinvented borgcfg for Kubernetes” :)
I’m guessing the switch to YAML, even though it might be a bit tedious, was an explicit reaction to the fact that the ultra-programmable borgcfg turned out to cause some big headaches.