Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Exceptions considered harmful
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Lauri Alanko <la@i...>
Subject: Re: [Caml-list] Exceptions considered harmful
On Tue, Jun 29, 2004 at 11:02:49AM +1000, skaller wrote:
> Any comments on any of this appreciated.

The paper "Exceptional Syntax" by Nick Benton and Andrew Kennedy would
probably interest you. It's published in JFP 11(4), 2001, and an
electronic copy can probably be found somewhere in the net. They propose
an exception syntax that is closer to Haskell's monadic style: an
expression either returns a value or raises an exception, so catching an
exception is like pattern matching: there's one case for the returned
value, others for possible exceptions:

try 
  x <- foo ()
in
  bar ()
unless
  E1 -> handle1 ()
  E2 -> handle2 ()

To my mind this seems very sensible.


Lauri Alanko
la@iki.fi

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners