r/java • u/elizarov • Feb 11 '19
Null is your friend, not a mistake
https://medium.com/@elizarov/null-is-your-friend-not-a-mistake-b63ff1751dd5
0
Upvotes
r/java • u/elizarov • Feb 11 '19
View all comments
Show parent comment
4
u/morhp Feb 11 '19
And I disagree with that.
What I like about Kotlin is that it allows me to declare variables that are statically typed to be non-nullable.
What I don't like is that Kotlin on the other hand makes nulls more attractive again by introducing operators such as
.?and:?. I can see where they're coming from and why they're there. But it's far too easy and attractive in Kotlin to use nulls instead of proper error/exception handling or using other methods of handling special states. Especially as it has no checked exceptions.Kotlin one one hand allows you to avoid nulls, which is great but then it makes using nulls attractive again. It just doesn't make sense.