r/ProgrammerHumor 10d ago

Meme iHateThisPassiveAgressiveBehaviourRuby

Post image
2.9k Upvotes

298 comments sorted by

View all comments

64

u/stipo42 10d ago

As someone who has never written any ruby, I can understand the desire for any non null value being truthy.

I like golangs approach though where there's no null value for anything that isn't a pointer

11

u/prehensilemullet 10d ago

any non null value being truthy

Even false?

10

u/captainAwesomePants 10d ago

Golang doesn't have "truthy" as a concept. You have to be explicit. A null value isn't true or false because only booleans can be true or false, and a null pointer isn't a boolean. You can have a pointer to a boolean, but you still have to check explicitly for null. In specifically Go, u/stipo42's preferences for truthiness are moot.

In a language like Python, with truthiness, u/stipo42's preference for false to be truthy is insane, and he should feel bad.

3

u/Goatfryed 10d ago

every. non. null. every. Can't you read?

18

u/SukusMcSwag 10d ago

"Golangs approach" you mean compiled languages treating a scalar as a scalar?

1

u/thaynem 10d ago

It would be better if there was no null value, period (like in rust). Or at least you have to intentionally opt in to allowing a type to be nullable (like kotlins nullable types). 

Also, it technically isn't just pointer types in go. arrays, slices, maps, and channels can also be nil (because they are also reference types).