3 ms·
> You're assuming I'm not. It's pretty clear that you don't know how null safe Swift, C#, and Rust work. IE: Rust has the option type for when a value can be
by gwbas1c 2y ago
> You're assuming
I'm not. It's pretty clear that you don't know how null safe Swift, C#, and Rust work.
IE: Rust has the option type for when a value can be null, and the compiler forces you to do an "empty" check. Otherwise, null, does not exist in the language.
Swift and C# are more metadata based. You indicate if a value supports null or not. The compiler will give you a warning, or error depending on configuration, if you try to assign null to a value that does not expect it.
All three languages have a concept of values that can be null, (or empty in Rust if you want to argue semantics,) so your type system tells you when a value can be null, or when it is expected to not be null. In all three languages, the compiler can force you to make assignments before you use an object.