News for hackers. Stuff that matters.
Re:New Features in Java 14 by strbean on Wednesday March 04, 2020 @04:14PM (#22488211)
Doesn't that approach make the "nothing branch" extremely expensive? Makes sense in scenarios where you really always expect Something and not Nothing. In practice, Options are very often used where something is optional, and you can expect to get Nothing a good percentage of the time. Using exceptions in such cases seems silly.
Re:New Features in Java 14 by thu2111 on Thursday March 05, 2020 @01:09PM (#22496242)
Yes if you expect nothing, you test for it obviously. The problem is when you want high quality errors for the case where you didn't expect it and you e.g. casted away the nullness, or it was casted away for you due to language interop.