14 comments

[ 3.4 ms ] story [ 44.8 ms ] thread
I'm surprised in a discussion of when to quote or not quote with YAML the dreaded "yes", "no", "true", "false", "on", and "off" booleans didn't come up.

Quoting the article:

> In YAML, you can write a string without quotes, if it doesn't have a special meaning.

Yeah, about that...

Indeed the if is doing a lot of work there ;)

What parent refers to, YAML's Norway Problem: https://hitchdev.com/strictyaml/why/implicit-typing-removed/

Didn't realise YAML's problems were that extensive, but I have to disagree with the seeming decision to effectively parse everything as strings instead of requiring all strings be quoted.
it's really a good lesson in "make it human-readable" being at odds with "make it easily parseable"
(comment deleted)
(comment deleted)
It is mentioned though ...

> Another use case for quotes is when you have a string that would be resolved as a special type. This highly depends on the YAML version and on the Schema in use. Here are some examples where you need quotes:

    true, false
    23
    1e3
    3.14159
    null
Eh, YAML 1.2 fixed this. It's only true/false now. The set of values that are special is pretty sane now.

    true, false, null, <ints>, <floats>
Quote strings, always.
(comment deleted)
Is this even a question? I double quote ALL strings. In fact, my C background makes me use " in Python too, even though single quote ' is acceptable. Somehow " feels more __stringy__.
“You guys’ heads are on backwards”, I said.

“How many times have your strings needed to convey some speaker’s voice? How many times have your coded strings needed to convey an object’s possession relationship?”

Apostrophe, 3.

Double quotes, 0.

(comment deleted)
For the love of God, save yourself pain. Always quote.