Today's Question:  What's your opinion about Alibaba mooncake incident?        GIVE A SHOUT



  Don't Overload #nil?

There’s a popular post on Hacker News about writing confident code by, among other things, overloading Object#nil? and returning “null objects” instead of nil itself.DO NOT DO THIS.In Ruby, all objects (except nil itself) coerce to the boolean value true. Your object will be nil and true at the same time. Bad things will happen. Your coworkers will cry. Sad people from around the world will ask bewildering questions on your mailing list.Here’s what happens:1 2 3 4 5 6 7 8 ...

1,209 0 0          RUBY OBJECT #NIL OVERLOAD