Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
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
   nice.
   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.

y


>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>