[Haskell-cafe] Re: exceptions vs. Either

André Pang ozone at algorithm.com.au
Fri Aug 6 11:08:14 EDT 2004

On 06/08/2004, at 7:43 PM, Keith Wansbrough wrote:

> Not so.  In Java, the programmer is forced to handle most exceptions
> by the type system.  That is, if the exception is not handled, the
> program will not compile, thus providing a static guarantee that
> exceptions are handled.

One feature I've always wanted is to be able to tell the compiler or 
run-time system (whichever is responsible for enforcing the type 
checks) to turn on exception checking or not.  That way, if you are 
programming in a fast and loose style (e.g. writing a throwaway 
script), exceptions don't get in your way, and you can program 
unencumbered by lots of useless error checking code.  If you then 
decide that the throwaway script isn't so throwaway after all, insert a 
pragma in your program, and get back full static checking.

If you know Perl, it's the equivalent of 'use strict;' for exceptions.  
I hope to see such a design in a Haskell compiler one day ...

% Andre Pang : trust.in.love.to.save

More information about the Haskell-Cafe mailing list