News for hackers. Stuff that matters.
Re:The Logical Disaster of Null by LandR on Thursday May 10, 2018 @04:17AM (#17037151)
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.

There are no comments on this comment yet.