Version française
Home     About     Download     Resources     Contact us    
Browse thread
Has the thread cancellation problem evolved ?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Daniel_Bünzli <daniel.buenzli@e...>
Subject: Re: [Caml-list] Has the thread cancellation problem evolved ?

Le 27 août 07 à 14:38, Jon Harrop a écrit :

> On Monday 27 August 2007 13:24:34 Daniel Bünzli wrote:
>> And if you are really not a sloppy programmer you
>> already have and use your own version of try/finally :
>>
>> let apply f x ~finally y =
>>    let res = try f x with exn -> finally y; raise exn in
>>    finally y;
>>    res
>
> Ironically, that's broken. :-)
>
> If your handler "finally" raises an exception then it would replace  
> the Abort
> exception. You should ignore any exception raised by "finally" if  
> "f" raises
> an exception.

It depends on which exception you eventually want to get at the  
toplevel, it is a choice. But I agree your choice makes more sense  
than mine.

> Then write in CPS and weave an abortable continuation between each  
> step.

Why not, but this a very low level solution and I cannot reuse  
existing libraries that are not written in this style. I don't think  
it is a reasonable answer.

Daniel