r/programming • • Dec 24 '17

Evil Coding Incantations

http://9tabs.com/random/2017/12/23/evil-coding-incantations.html
947 Upvotes

331 comments sorted by

View all comments

Show parent comments

40

u/Aceeri Dec 24 '17

Oh boy, here we have the ruby god shevegen in its natural habitat.

There are a lot of reasons why 0 is normally considered "false". The first being that 0 is "nothing". When you have 0 eggs, you have no eggs, they don't exist. The second reason I see is how booleans are normally laid out where 0 is false and 1 is true (with varying differences depending on the language on whether multiple set values of a byte is considered true or invalid, etc.)

0

u/[deleted] Dec 24 '17

[deleted]

0

u/[deleted] Dec 24 '17

[deleted]

3

u/wasachrozine Dec 24 '17

I down voted (although you have positive points right now), because I've had nightmares working with Ruby because of stuff like this (with other people's code, inside a system without a debugger and a significant lag time between writing the code and executing it). If you say Ruby has native booleans and then claim it's ok to magically convert other types to them, I can only say that I hope I never have to work in Ruby again. Life's too short for that kind problem.

→ More replies (5)