Re:Java 8’s new Optional type doesn't solve anything
by acaloiar on Monday October 26, 2015 @08:52AM
(#10451036)
I believe the point @jontro is making is that unsafe programming behavior is unsafe without regard to the language's constraints. Option simply makes it more difficult to behave unsafely. Of course a developer can still call .get() when the presence of a value is unknown, but the Option type lets them know they are being careless in doing so.
Re:Java 8’s new Optional type doesn't solve anything
by the_af on Monday October 26, 2015 @11:39AM
(#10452115)
No, the author considers it ineffective because you are not forced to think about nulls at compile time. Of course, at run time they will explode in your face, so you still have to consider them eventually.
@jontro is saying that proper Optionals make it impossible (or at least, more difficult) to forget about the problem at compile time.
It's a curious feature, the way you've described it. I have virtually no experience with Java so I'm looking at this from a totally foreign perspective. The authors considers it an ineffective feature because you still have to think about null checks, whereas you consider it an effective feature because it forces you to think about the problem instead of ignoring it.