Either

From APIDesign

Revision as of 12:52, 9 January 2025 by JaroslavTulach (Talk | contribs)
(diff) ←Older revision | Current revision (diff) | Newer revision→ (diff)
Jump to: navigation, search

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.

Personal tools
buy