3 ms·
> A type system can keep you from having to write those tests. Because with a proper static lang (hint: not Java, not C#), nil doesn't exist? Right.
by siwatanejo 4y ago
> A type system can keep you from having to write those tests.
Because with a proper static lang (hint: not Java, not C#), nil doesn't exist? Right.
- creakingstairs 4y agoThey all have nulls but a static lang will warn you that the value can be null.
- tene 4y agoThis is false. There are plenty of languages without pervasive implicit nullability. Check out Haskell and Rust and Ocaml.
- creakingstairs 4y agoYou are right. I should have said some. The point I wanted to make was that having type safety is better for checking null than having no type at all.
- ebingdom 4y agoThose languages don't have null safety, but plenty of languages do. Rust, Kotlin, Swift, Haskell, etc. The claim is true: a type system _can_ prevent null-related issues and eliminate the need to account for them in tests. That's not the same as saying every type system does.
- campl3r 4y agoDoesn't C# support this by enabling Nullable?
- shepherdjerred 4y agoIt can if you choose to return Optionals instead of nulls.