by jcromartie · 15y ago · 0 comments
"One way that Erlang differs from OO languages is its emphasis on failure. Any message can fail. Processes don't raise an exception, they fail. Systems are structured as worker processes at the bottom that are likely to fail, with manager processes above them that restart the failed processes. Because programmers expect processes to fail, they"
It helped me tremendously to understand error handling in erlang when I realised every line of code was a point of failure
Java forces you to handle things like FileNotFound even if you fully expect the file to be there, erlang you would not handle file not found at all, but you would manage all errors at a higher level for the entire unit of code that expected the file to be there.
Yes, Erlang embraces failure and provides ways do deal with it by design. No, it's not a replacement for exceptions. Especially that Erlang does have exceptions to deal with the typical "could fail, so we'll just `try` it" programming.