10 Pines Blog

Symbols: the new return codes? (Pt. 2)

ruby nil closures symbols exceptions

Flow control with exceptions and closures

In this previous post we’ve considered the benefits and inconveniences of using nil and symbols as return values in a method. Now we’ll evaluate the possibility of throwing an exception, and yet another alternative: using a closure.

29 Sep 2014

Symbols: the new return codes?

ruby nil closures symbols exceptions

Recently I’ve read a tweet from Yehuda Katz in which he suggested an interesting idea, as an alternative for using nil as a result from a method: to use a symbol instead.

Well, this post is about the reasons why I think you shouldn’t use a symbol, and why even returning nil is a preferable option.

24 Sep 2014