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
Preferred use of Invalid_argument and Failure
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-10-24 (07:09)
From: Alain Frisch <alain@f...>
Subject: Re: [Caml-list] Preferred use of Invalid_argument and Failure
Michaël Le Barbier wrote:
> I am working on a library, I want the interfaces to look like standard
> library modules interfaces.
> Again, I would be glad to get advices of discipline in using
> theses two exceptions. What works for you?

My advice would be not to use these two exceptions and to define custom 
exceptions in your library. You'll be able to pattern match on them 
more easily and to store extra relevant information. Of course, this 
breaks your design constraint of looking like the standard library.

-- Alain