Hacker News new | ask | show | jobs
by youerbt 2444 days ago
Java is also advertised as "enterprise" language and it can't even encode in its type system that a piece of data can be missing. Or maybe it can, with Optional<T>, thanks Haskell.

I can't tell I had less problems understanding magic container IoC stuff than most Haskell concepts.

2 comments

To be pedantic, Java perfectly encodes the information that a piece of data can be missing - any type supports null as a valid value. What it can't do is encode the information that a piece of data CAN'T be missing.
To be even more pedantic, Java's primitive types (int instead of Integer etc.) have this feature. They can't be null.
> maybe it can, with Optional<T>

Not even that. Java's optionals are almost useless, needlessly verbose, you still don't have pattern matching, and there's also still null to contend with.