From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id A40D7BC6B for ; Mon, 27 Aug 2007 14:49:48 +0200 (CEST) Received: from ptb-relay01.plus.net (ptb-relay01.plus.net [212.159.14.212]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l7RCnm0O027659 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO) for ; Mon, 27 Aug 2007 14:49:48 +0200 Received: from [80.229.56.224] (helo=beast.local) by ptb-relay01.plus.net with esmtp (Exim) id 1IPe2N-0003Ed-L3 for caml-list@yquem.inria.fr; Mon, 27 Aug 2007 13:49:47 +0100 From: Jon Harrop Organization: Flying Frog Consultancy Ltd. To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Has the thread cancellation problem evolved ? Date: Mon, 27 Aug 2007 13:38:51 +0100 User-Agent: KMail/1.9.7 References: <9FA25C33-04DD-46BD-8959-873DDD2FFF82@epfl.ch> <1188214119.13927.16.camel@rosella.wigram> <07BE0325-B260-407C-A1BB-389D4C88311C@epfl.ch> In-Reply-To: <07BE0325-B260-407C-A1BB-389D4C88311C@epfl.ch> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200708271338.51566.jon@ffconsultancy.com> X-Miltered: at concorde with ID 46D2C86C.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; bunzli:01 exn:01 exn:01 computations:01 ocaml:01 ocaml:01 frog:98 wrote:01 exception:01 exception:01 caml-list:01 functions:01 functions:01 arbitrary:02 cps:02 On Monday 27 August 2007 13:24:34 Daniel B=FCnzli 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 =3D > let res =3D 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 Abo= rt=20 exception. You should ignore any exception raised by "finally" if "f" raise= s=20 an exception. > Anyway most of the things I would like to cancel are not functions > dealing with channels or locks but functions that do perform > intensive numerical computations. In the presence of a human user you > cannot let the ui hang for arbitrary long period of time, he should > be able to cancel if he gets bored. Then write in CPS and weave an abortable continuation between each step. =2D-=20 Dr Jon D Harrop, Flying Frog Consultancy Ltd. OCaml for Scientists http://www.ffconsultancy.com/products/ocaml_for_scientists/?e