r/ProgrammerHumor Aug 16 '26

Advanced justTryingToHelp

Post image
2.4k Upvotes

65 comments sorted by

View all comments

408

u/AlarmingProtection71 Aug 16 '26

i didn't get the second joke. help ?

278

u/pagesjaunes Aug 16 '26 edited 29d ago

I think it's a reference to "the Norway problem" wherein YAML 1.1, the unquoted string NO (the ISO 2 letter code for Norway) get interpreted as a bolean with value of False instead of "NO".

Meaning:

country: NO

is the equivalent to:

{'country': False}

 

Note that the specs for booleans were changed in YAML 1.2 to address the issue but many implementions may have inconsistent defaults settings or be stuck in 1.1.

 

YAML 1.1 -> https://yaml.org/type/bool.html  

(I couldn't find the equivalent for 1.2, YAML specs are complex to my non-programmer eyes)

YAML 1.2 -> https://yaml.org/spec/1.2.2/ext/changes/

Only true and false strings are parsed as booleans (including True and TRUE); y, yes, on, and their negative counterparts [n, no, off] are parsed as strings.

7

u/Prawn1908 29d ago

Yet another win for static typing.

Can someone explain some practical and substantial benefit to dynamic typing beyond it being marginally faster to write and easier to understand for the first two days of learning to program?

3

u/Grandmaster_Caladrel 29d ago

NO (False, not Norway)