The following lines appear in http://aosabook.org/en/riak.html in the second paragraph of the section: 15.1. Short introduction to Erlang :
"Calling a function with a negative number will result in a runtime error, since none of the sentences matches. Do not handle this case is an example of unprotected programming, a practice encouraged in Erlang."
Two questions: what is the idiomatic way of handling the error in Erlang; and why is it better than covering all cases explicitly, like in languages like OCaml or Haskell?
source
share