3 ms·
No doubt the problem is more complex and like I said would need language level syntax support. Sorry yes you're correct, optional containing null is the same a
by derriz 2y ago
No doubt the problem is more complex and like I said would need language level syntax support.
Sorry yes you're correct, optional containing null is the same as an empty optional. So there are 3 cases, not 4.
But saying that "it's a valid case for NPE" missed the point I believe as you're taking about dealing with the issue at runtime. The killer feature of having language level support for distinguishing null and not-null is that these errors are flagged at compile time, not runtime.
- ivan_gammel 2y ago>But saying that "it's a valid case for NPE" missed the point I believe as you're taking about dealing with the issue at runtime. What I mean is that this issue (null instead of Optional) is rare enough not to bother about it and let NPE happen. Language support for null/non-null values in general would be nice, of course.