Did you know that you can navigate the posts by swiping left and right?

The YAML-NOrway Law

20 Jun 2018 . category: programming . Comments

Anyone who uses YAML long enough will eventually get burned when attempting to abbreviate “Norway.”

YAML Ain’t Markup Language (YAML) is a human-readable data serialization language, and if you ever try to abbreviate “Norway,” you just might run into a surprising outcome.

Here’s an example:

NI: Nicaragua
NL: Netherlands
NO: Norway # boom!

Does it work? NO|No|no, but not “NO”. NO is parsed as a boolean type, which with the YAML 1.1 spec, there are 11 ways to say false:

  • n
  • N
  • no
  • No
  • NO
  • false
  • False
  • FALSE
  • off
  • Off
  • OFF

The correction:

NI: Nicaragua
NL: Netherlands
'NO': Norway

This has been fixed in the YAML 1.2 spec, but many YAML parsers still use 1.1 by default.


Personally, I don’t mind YAML. It makes things easy. But, this, along with many of the design decisions in YAML strike me as a simple vs. easy tradeoff, where the authors opted for “easy,” at the expense of simplicity. I, and I assume many others, mostly use YAML for configuration. I want and need my config files to be dead simple, explicit, and predictable. YAML isn’t perfect, and the authors humbly acknowledge that. But when it comes to config, “easy” (and the unexpected surprises that come with it) can take a back seat.


Me

I'm a software engineer, proud veteran, and even prouder husband and father. I live and work in Silicon Valley, and love to learn about learning (EdTech), ML/AI/RL, and cybersecurity.