Version française
Home     About     Download     Resources     Contact us    
Browse thread
Today's inflamatory opinion: exceptions are bad
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Andreas Rossberg <AndreasRossberg@w...>
Subject: Re: [Caml-list] Today's inflamatory opinion: exceptions are bad
"Brian Hurt" <bhurt@spnz.org> wrote:
>
> For the former, returning a variant type ('a option if nothing else) is a 
> better idea, for (at least) two reasons.  One, the type system enforces 
> the requirement to actually handle the error, at the location the return 
> value of the function is desired.  Want the result?  Handle the errors.

I guess Joe Armstrong (of Erlang fame) would have to say a lot about how to 
deal with failure properly. According to him, and the seemingly successful 
Erlang philosophy (which is, "let it crash"), attempts to locally handle 
errors are exactly the wrong approach. See his very insightful thesis.

> My point here is this: Ocaml is not Java (a fact we should all be 
> gratefull for, IMHO).  Simply because Java and C++ do something, doesn't 
> mean that it's a good thing to do.

Now, ML had exceptions before C++ was even called C++, and one and a half 
decades before anybody ever heard of Java. In fact, Stroustrup says that C++ 
exceptions were inspired by ML (too bad he did not take more inspiration 
from there :) ). ML took the concept from CLU, IIRC, which was a language 
particularly designed to improve various aspects of large scale software 
engineering.

- Andreas