From bff51607cfdda137d7bc55d802895d7f794d5768 Mon Sep 17 00:00:00 2001 From: Pierre-Marie Pédrot Date: Wed, 3 Dec 2014 20:34:09 +0100 Subject: Getting rid of Exninfo hacks. Instead of modifying exceptions to wear additional information, we instead use a dedicated type now. All exception-using functions were modified to support this new type, in particular Future's fix_exn-s and the tactic monad. To solve the problem of enriching exceptions at raise time and recover this data in the try-with handler, we use a global datastructure recording the given piece of data imperatively that we retrieve in the try-with handler. We ensure that such instrumented try-with destroy the data so that there may not be confusion with another exception. To further harden the correction of this structure, we also check for pointer equality with the last raised exception. The global data structure is not thread-safe for now, which is incorrect as the STM uses threads and enriched exceptions. Yet, we splitted the patch in two parts, so that we do not introduce dependencies to the Thread library immediatly. This will allow to revert only the second patch if ever we switch to OCaml-coded lightweight threads. --- lib/future.mli | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/future.mli') diff --git a/lib/future.mli b/lib/future.mli index bae4fa7514..d97b46382f 100644 --- a/lib/future.mli +++ b/lib/future.mli @@ -66,8 +66,8 @@ module UUIDSet : Set.S with type elt = UUID.t exception NotReady type 'a computation -type 'a value = [ `Val of 'a | `Exn of exn ] -type fix_exn = exn -> exn +type 'a value = [ `Val of 'a | `Exn of Exninfo.iexn ] +type fix_exn = Exninfo.iexn -> Exninfo.iexn (* Build a computation, no snapshot of the global state is taken. If you need to grab a copy of the state start with from_here () and then chain. @@ -98,7 +98,7 @@ val fix_exn_of : 'a computation -> fix_exn (* Run remotely, returns the function to assign. If not blocking (the default) it raises NotReady if forced before the delage assigns it. *) -type 'a assignement = [ `Val of 'a | `Exn of exn | `Comp of 'a computation] +type 'a assignement = [ `Val of 'a | `Exn of Exninfo.iexn | `Comp of 'a computation] val create_delegate : ?blocking:bool -> fix_exn -> 'a computation * ('a assignement -> unit) -- cgit v1.2.3