5 ms·
Idiomatic F# code also uses Option types. However, all .NET reference types have null as a possible value. While most F# types don't have null as a "normal" v
by kvb 11y ago
Idiomatic F# code also uses Option types. However, all .NET reference types have null as a possible value. While most F# types don't have null as a "normal" value, there's nothing to prevent null instances of these types from being created "abnormally" at the .NET runtime layer (e.g. values of F# types created in other .NET languages like C# that don't respect F#'s metadata annotations, or created via F# operators like Unchecked.defaultof<_> that implicitly use the .NET runtime's default value of null for reference types).
In practice this is rarely a problem, but the article is highlighting what you need to do when you want to (efficiently) check for these boundary cases.