|
|
|
|
|
by toolslive
4324 days ago
|
|
The heuristic is that if the case is more frequent than something like 1/1000 then you don't use exceptions in these languages (C++, Java, ...). As they are a lot cheaper in languages like ML, people there tend to use them more for early exits out of things like folds. A simple example: let prod = List.fold_left (fun acc a -> acc * a) 1.0 xs
should not fold over the whole list if a factor is 0.0
so they tend to use exceptions for that (or delimited continuations) |
|