A few days ago I stumbled apon Paul Phillips awesome talk “Inside the Sausage Factory” – explaining some internals of the Scala compiler. In his talk he mentions that he does not like using
Option since it is “tedious and syntax heavy”. He suggests to use the “null object pattern” – creating a “distinguishable object to server the role of none”.
A problem with this approach is that one looses all the nice methods
Option provides such as
map. In this post we will see how we can get the best of both worlds by using implicits.