> The truth is that the concept of null is not mistake, but Java’s type-system, that considers null to be a member of every type, is.

But that’s what people complain about when they talk about null. You seem to think that people complain about null from a conceptual POV: no, people complain about the fact that there is no type to state that something isn’t there. That’s why Optional exists: to bring that information upfront.

Now Kotlin decided to lift that information into the type system in a different way (via ? types) but the idea is the same.

Idk if you made the title of the article to be click-baity or if you are just thinking of null as its own entity (instead of the concept of not there). But either way, Optional<Int>, Maybe Int, Int?and Int i = ...; if (i!=null) all have the same semantics: Either something is there or it isn’t there. When most people complain about “null is horrible!” they are talking about the last one: the one where you can’t tell if there is something there via the type system.

Some Haskeller

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store