r/ProgrammerHumor 20h ago

Meme iHateThisPassiveAgressiveBehaviourRuby

Post image
2.5k Upvotes

270 comments sorted by

View all comments

436

u/deceze 20h ago

It's been a while since I've touched Ruby, but I think the stance was that only false and nil should be falsey? Which is not an unreasonable stance to take. The fewer falsey values, the easier it is to predict the behaviour. It's just surprising when coming from other languages.

Just off the top of my head, PHP treats "0", that is, specifically a string with a single zero, as falsey. Which has clearly gone too far to the other extreme.

62

u/Bomaruto 19h ago

The reasonable stance is to not let you coerce everything into a boolean.

8

u/R3D3-1 10h ago

Is this a good time to remember that people argued against Python getting booleans because it already had integers?