Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Why is “on” a boolean literal (of course so are “true”, “false”, as well as “yes”, “no”, “y”, “n”, “off”, and all capitalized and uppercase variants)?

Norway is also "False".



Or more precisely, its country code 'NO' is false. I don't think there are any YAML parsers that parse the literal string 'Norway' as false.


The YAML 1.2 spec removed “no” as a synonym for false. That arguably just made that entire problem worse, and even though it’s been almost 15 years YAML 1.1 is still the commonly used variant.


Ah, that explains why I couldn’t find any online YAML->JSON converters that would demonstrate this flaw when it came up a few weeks ago.

So now we have the same language that parses the same document subtly differently depending on what version you use. Hooray?


Be the change you wish to see in the world.


I would support a move for YAML to standardize on both "NO" and "Norway" evaluating to false. It seems an obvious win for consistency.


Surely it should accept either "Norway", "Norge" or "Noreg" depending on the locale setting.


Hmmmmmm. In that case the "nodding head" emoji should evaluate to false when the locale is set to Bulgarian...


Maybe one written by a Geordie?


It’s very obvious that’s what he means.


It wasn’t obvious to me. I read it as the literal string “Norway” being parsed as false, which didn’t sound believable but I didn’t make the connection to NO at all.


shrug it wasnt obvious to me. I'm glad someone explained.


And yet it doesn't recognize that the UK is false[0].

[0] https://en.wikipedia.org/wiki/Perfidious_Albion




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: