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
[OSR] Exceptionless error management
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2008-02-01 (12:19)
From: Yaron Minsky <yminsky@g...>
Subject: Re: [Caml-list] [OSR] Exceptionless error management
We've come to be pretty leery of exceptions at Jane Street, and we've had
some experience trying to control their use  Some quick observations on the
current proposal:

   1. Banning exceptions outright seems too strict.  Our tendency has
   been to have two versions of the function, e.g., Map.find and
   Map.find_exn.  (Our previous approach would have been to use
   Map.find_opt for the one that returns and option and Map.find for the
   exception-throwing one, but we're slowly migrating to the first proposal.)
   The goal is to make the user aware that an exception is reasonably likely,
   rather than ban exceptions.
   2. We've played around with monadic error systems that combine errors
   into a big polymorphic variant.  The key practical problem we hit were
   obscenely complicated error messages.  Still, in some cases, monads are very
   3. Having a variant type other than option so you can specify various
   different errors (ours is Ok of 'a | Error of 'b) is a good idea.  And I
   think it's common enough that you should define it in your core library as
   an ordinary variant and make it available everywhere.


> _______________________________________________
> Caml-list mailing list. Subscription management:
> Archives:
> Beginner's list:
> Bug reports: