Let me illustrate what bothers me about having to distinguish “has a value, but it is unknown” and “has no value” in programming:
-
You may not know. If there is no information about siblings, you do not know whether to assign
NameOfSistertomissing(“has a value, but it is unknown”) or anothing(“has no value”). -
No standard for optional arguments because the types are loaded with meaning:
# Input, if you have a coupon
buy(..., coupon::Union{String,Nothing}=nothing)
# Input, if you know the DNA of your mom.
healthanalysis(..., mom::Union{DNA,Missing}=missing) -
Production of
missingtypes into codes that may not be programmed to handle it (kudos to @kristoffer.carlsson). Would you dare to define the generally intractableisconvex(function)or the generally undecidableishalting(callable)as aUnion{Bool,Missing}even though they are definitely of the “has a value, but it might be unknown” type? I never want that because the three-way-logic would hide bugs in my code.
What is more appropriate in my opinion is to distinguish “value not available (if it exists, it is unknown)” and “definitely has a value, but it is unknown”. The former would be the standard goto type for all items in the enumeration above, whereas the second would be a specialization you opt into when needed. In practice, this is how I see Nothing and Missing already being used today.