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: Michael Ekstrand <michael+ocaml@e...>
Subject: Re: [Caml-list] [OSR] Exceptionless error management
David Teller <David.Teller@univ-orleans.fr> writes:
> What else ? We could presumably functorize modules upon the definition
> of a error-delivery mechanism, but that might be overkill. 
>
> Say
> module type ErrorMechanism = sig
>   type 't;                (**The type of a failure.*)
>   type 'a can_fail; 
>                           (**The type of a value that can either succeed
>                              and produce a result of type 'a or fail and
>                              produce an error of type t. *)
>   value fail    : t -> 'a can_fail ; 
>                           (**Fail. Depending on the mechanism, this may
>                              either return some variant on option or
>                              throw an exception.*)
>  
>   value succeed : 'a -> 'a can_fail ;
>                           (**Succeed.*)
> end;;

This could have some interesting ramifications, such as aiding in the
construction of a condition/restart mechanism.

However, standard instantiations of these functorized modules should
probably be provided to make the common case (using the module with
one or the other standard behavior) easy.

- Michael

-- 
mouse, n: A device for pointing at the xterm in which you want to type.
Confused by the strange files?  I cryptographically sign my messages.
For more information see <http://www.elehack.net/resources/gpg>.