6 ms·
> 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
by bencelaszlo 3y ago
> 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".
- foldr 3y agoOr 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.
- julian_t 3y agoMaybe one written by a Geordie?
- Exuma 3y agoIt’s very obvious that’s what he means.
- gremlinunderway 3y agoshrug it wasnt obvious to me. I'm glad someone explained.
- afavour 3y agoIt 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.
- sgarland 3y agoBe the change you wish to see in the world.
- andybak 3y agoI would support a move for YAML to standardize on both "NO" and "Norway" evaluating to false. It seems an obvious win for consistency.
- sakjur 3y agoThe 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.
- basil-rash 3y agoAh, 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?
- Y_Y 3y agoAnd yet it doesn't recognize that the UK is false[0]. [0] https://en.wikipedia.org/wiki/Perfidious_Albion https://en.wikipedia.org/wiki/Perfidious_Albion