Hacker News new | ask | show | jobs
by Tainnor 1046 days ago
> Having compiler enforced null checking does not reduce the amount of nulls you need to check.

If a function in a null-safe language is declared to return "String", then it signals that, effectively, you don't have to check for null. So, yes, compiler-enforced null safety does reduce the amount of nulls you need to check.

The trick, of course, is to not make everything nullable, but as few things as possible.

In Kotlin, of course, this is only true up to the point where Java interop might interfere with it (because Kotlin might infer a Java return type to be non-nullable when it's in fact nullable).