Hacker News new | ask | show | jobs
by dasil003 4865 days ago
But the combination of Tom's reputation and the nightmare security situation currently unfolding with YAML means this project has a very high likelihood of becoming defacto standard in the Ruby community. The thought of being able to get rid of YAML from my code base entirely is an appealing end unto itself. Security aside, YAML is just ridiculously complex and error-prone.

Can you tell at a glance what is wrong with this YAML snippet:

  scandinavia:
    SE: Sweden
    NO: Norway
    FI: Finland
1 comments

I'm not familiar enough with YAML to see the problem at a glance but parsing the snippet with an online parser [1] suggests that unless you put quotation marks around "NO" it gets parsed into a boolean False. Looks precarious, especially since not requiring strings to be quoted is kind of a selling point of YAML.

[1] https://yaml-online-parser.appspot.com/

That's it, but you cheated :)

I had to spend half an hour debugging a bizarre side effect of that parsing to pinpoint the problem.

That is utterly stupid isn't it, how could the designers of YAML count a capital "NO" as a key as False. Wow.

Edit, holy fuck all these are booleans:

y|Y|yes|Yes|YES|n|N|no|No|NO |true|True|TRUE|false|False|FALSE |on|On|ON|off|Off|OFF