3 ms·
It's basically a definitional thing. An Option type means you must specify Some (pointer) or could-be-None (null, NULL pointer) and the compiler will enforce t
by samatman 6y ago
It's basically a definitional thing.
An Option type means you must specify Some (pointer) or could-be-None (null, NULL pointer) and the compiler will enforce the distinction. Generally this comes with exhaustive pattern matching, so you can turn Some<T> into <T>, and handle None by raising an error or assigning a default or blowing demons out your nose.
None and null are the same thing, the name isn't the important part. Zig, for example, has optional types as ?*Foo, and calls the null pointer "null".