Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] assertions or exceptions?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: skaller <skaller@u...>
Subject: Re: [Caml-list] assertions or exceptions?
On Thu, 2004-07-15 at 23:45, Radu Grigore wrote:

> Those solutions are:
>  1. use another library
>  2. provide your own workaround (by redesigning the interface)
> I fail to see how this vindicates the design of the standard library.

I believe there is a good argument for using exceptions
in the standard library. It goes like this:

There are situation where a function call can fail.
Perhaps here an exception is not as good as a sum type.

But there are other situations where it can be proven
a function call cannot fail. In these circumstances,
using exceptions leads to simpler and more efficient
code: the downside is you have to manually maintain
the proof that an exception can't be thrown in the
face of the changes software always goes through.

In balance, it is probably fairly arbitrary which
mechanism to present the client.

Ocaml is reasonably consistent though, and that
is probably what matters most. 

John Skaller,
voice: 061-2-9660-0850, 
snail: PO BOX 401 Glebe NSW 2037 Australia
Checkout the Felix programming language

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: