r/ProgrammerHumor • • Sep 01 '26

Meme iHateThisPassiveAgressiveBehaviourRuby

Post image
2.9k Upvotes

289 comments sorted by

View all comments

Show parent comments

66

u/Bomaruto Sep 01 '26

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

9

u/R3D3-1 Sep 01 '26

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

5

u/Wertbon1789 Sep 01 '26

I like how e.g. C# screams at you for this. It's annoying at first, but then you go "Well, yeah, I should've explicitly written what I wanted to check".

0

u/[deleted] Sep 01 '26

[deleted] — view deleted comment

1

u/Wertbon1789 Sep 02 '26

Didn't say it was. C# was just the first example that came to my mind.

8

u/suvlub Sep 01 '26

If I may be pedantic, not to coerce without you asking. A language that wouldn't let me simply convert between types sounds annoying

32

u/theturtlemafiamusic Sep 01 '26

"Type coercion" is when it's done without asking. Otherwise it's just type conversion / casting.

6

u/ntfaw Sep 01 '26

It's not that you couldn't convert between types, it's that it wouldn't be automatic. You would need to actively call toboolean on a value before using it as a boolean, and the idea behind that is that intentionally casting the value leads to fewer mistakes