I think using an Option / Maybe over null has the benefit of the caller knowing that the method might not return something.
e.g.
public Foo GetFooWithId(int id){...}
When I call that, I might get a Foo but what if I don't... Will it be null, is Foo a struct or a class? I have to know what Foo is and check if I need to check the result for null.
As opposed to
public Maybe<Foo> GetFooWithId(int id) {...}
I know just from reading that I might not get a Foo back so I had better match over the result.
e.g.
When I call that, I might get a Foo but what if I don't... Will it be null, is Foo a struct or a class? I have to know what Foo is and check if I need to check the result for null.As opposed to
I know just from reading that I might not get a Foo back so I had better match over the result.