After using F# option type for a while, I realize that it could be used for handling exceptional cases. I can use either option or Exception in the following examples:
- The
findfunctions from List/Array/Seq modules raiseKeyNotFoundExceptionin uncommon cases, while correspondingtryFindcounterparts returnNonein those situations. - When I do backtracking (in solving N-queens, Sudoku, etc), whenever a branch has no solution, I can either raise an exception and catch it later or return None to match that value to backtrack. Those cases occur quite often until we find a solution.
My impression is option is a more functional approach, while Exception is more commonly-used in the .NET platform.
What are differences between option and Exception in exception handling in terms of usability, performance, etc? In which cases using a technique is better than using the other?