News for hackers. Stuff that matters.
Re:What Color Is Your Monad by dllthomas on Wednesday February 16, 2022 @01:17PM (#30363543)
I'm not sure you quite said this but nullable isn't just another word for Optional with syntactic sugar. You can have Optional<Optional<Integer>>, but Integer?? is not a thing. This means you can't (or shouldn't?) use it for, say, return value of a generic "get a value from a map" because you might want to be able to store nullable values in the map and probably want to distinguish "it wasn't there" from "it was there but the value was null". IIRC, in some languages with generics and nullable you can't actually write a function that applies ? to a generic argument, because there's no way to say that the generic argument isn't itself nullable.

There are no comments on this comment yet.