[Nix-dev] Re: Proposal: tryCatch function

Eelco Dolstra e.dolstra at tudelft.nl
Tue Jan 6 09:32:57 CET 2009


Hi,

Marc Weber wrote:

>> Another concern is that it catches all exceptions.  Compare this with
>> what other languages typically provide, where only exceptions of the
>> specified type are caught (it's also usually possible to catch
>> exceptions of any type, e.g., by specifying `Exception' as the exception
>> type in Java, but that has to be made explicit.)
> 
> We don't have types.. Are you thinking about
> catchString catchAttrs catchNull catchList  ?

You could throw a value, and rethrow it if you can't handle it.  However, having
distinct kinds of exceptions is a problem in a purely functional language, since
the exception that gets thrown might depend on the evaluation order.  This is
why Haskell only allows exceptions to be caught in the I/O monad.

-- 
Eelco Dolstra | http://www.st.ewi.tudelft.nl/~dolstra/



More information about the nix-dev mailing list