Why can't we merge Missing and Nothing?

You should not think of nothing and missing as solutions that cover all possible scenarios. They are intended to work in some very common ones, but you are free to design your own more elaborate extensions or alternatives — what’s nice about Julia is that they will be given equal treatment (compiler optimizations, etc).

API design and data encoding are both hard problems. You should think of Julia not as a solution, but as a toolbox to iteratively build a solution.

As for your particular questions: it is hard to say more without context, but

  1. I would not define NameOfSister at all. Perhaps a siblings accessor, the elements of which I could then query with name and gender, which could return missing.

  2. For optional arguments, I would use nothing if that would take me to a different branch (explicitly, in the code), missing if I wanted to rely on generics. But that’s just my own style and I don’t follow it consistently.

  3. I would not define isconvex and ishalting at all, because I don’t know how to implement them (for generic objects). In fact, I would not define function return types at all, that’s what we have a compiler for.

3 Likes