[erlang-questions] : Old school exceptions vs. new age one

Raimo Niskanen <>
Wed Apr 30 12:20:12 CEST 2008


On Mon, Apr 28, 2008 at 07:25:01AM -0700, Thomas Lindgren wrote:
> 
:
> 
> I have to note that I nearly always use 'catch' rather
> than 'try', and even consider 'catch' taking care of
> all cases in a great big mess the usually desired
> behaviour. But since I so clearly Don't Get It, I'm
> wondering: what properties of 'try' do people consider
> great _in practice_? What has saved your bacon in
> switching from old to new school?
> 
> * ability to differentiate between exception kinds?

In any kind of library'ish code it is invaluable
do be able to distinguish between a return
value of {'EXIT', _} and a real exception.

Using catch is simply not an option since
it can be spoofed and you can not guarantee
what your library is doing.



> * ignoring the exception handler on mismatch?
> * the 'finally' clause?
> * syntax is nicer?
> * something else? if so, what
> 
> Best,
> Thomas
> 

-- 

/ Raimo Niskanen, Erlang/OTP, Ericsson AB



More information about the erlang-questions mailing list