1 min readFeb 18, 2019
A full-blown union type is indeed one way to solve it, but adding union types to Java would not solve it, since Java’s String
type already allows null
. First step is to fix this mistake in type-system. So, more type-safe languages start with not allowing null
for String
type and then add some mechanism to deal with the case of “value missing” (union type is just one way to deal with it).