Either
From APIDesign
(Difference between revisions)
JaroslavTulach (Talk | contribs)
(New page: I am a great supporter of checked exceptions. Maybe not exactly as realized in Java, but I believe the concept (after few homey touches) deserve to be love! Scala offers ***sc...)
Next diff →
Current revision
I am a great supporter of checked exceptions. Maybe not exactly as realized in Java, but I believe the concept (after few homey touches) deserve to be love!
Scala offers ***scala.Either<ReasonOfFailure, ReturnValue>*** and I read somewhere an article favoring **Either** over java/util|Optional exactly for the reason that _None_/empty misses the reason why it is empty. Some might say, use **Either** then!
However I believe that even better concept are checked exceptions. Thus use checked exception to deliver *reason of failure* (that needs to be handled) and proper return value to deliver the real result.