bestie / objective-ruby-style-guide

An objective style-guide for righteous Ruby codes
19 stars 1 forks source link

Take a stronger stance on nil #8

Open fables-tales opened 10 years ago

fables-tales commented 10 years ago

What about:

  1. Never explicitly return nil, it's almost certainly not duck typed the same as the thing you're actually returning
  2. Immediately wrap nils returned by third parties in null objects or maybe monads?
bestie commented 10 years ago

While I totally agree with that I'm not sure such a prescription falls under style which I define as something like "different syntax for expressing the same behaviour". Isn't this a more fundamental design prescription? If so should this sort of thing be included?

fables-tales commented 10 years ago

I guess it depends. Is this limited only to objective style, or causing good design to fall out of style guidelines?