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=none 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 24045BC0B for ; Mon, 15 Jan 2007 23:12:22 +0100 (CET) Received: from mail19.bluewin.ch (mail19.bluewin.ch [195.186.18.65]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l0FMCLdO006985 for ; Mon, 15 Jan 2007 23:12:21 +0100 Received: from [10.0.1.2] (85.2.76.105) by mail19.bluewin.ch (Bluewin 7.3.118) id 45AB8E1A0001DAF9 for caml-list@yquem.inria.fr; Mon, 15 Jan 2007 22:12:21 +0000 Mime-Version: 1.0 (Apple Message framework v752.2) In-Reply-To: <200701152130.44615.jon@ffconsultancy.com> References: <45A87011.8080203@gmail.com> <20070115000544.GA28731@snarc.org> <200701152130.44615.jon@ffconsultancy.com> Content-Type: text/plain; charset=ISO-8859-1; delsp=yes; format=flowed Message-Id: <81E583BC-438F-41C7-A940-6DF083763845@epfl.ch> Content-Transfer-Encoding: quoted-printable From: =?ISO-8859-1?Q?Daniel_B=FCnzli?= Subject: Try finally (was Re: [Caml-list] Ocaml compiler features) Date: Mon, 15 Jan 2007 23:13:58 +0100 To: caml-list@yquem.inria.fr X-Mailer: Apple Mail (2.752.2) X-Miltered: at concorde with ID 45ABFC45.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; bunzli:01 buenzli:01 ocaml:01 compiler:01 syntax:01 pervasives:01 remy's:01 exn:01 exn:01 unix:01 caml-list:01 remy:01 poly:02 epfl:02 let:03 Le 15 janv. 07 =E0 22:30, Jon Harrop a =E9crit : > try ... finally is another syntax extension that I think would be =20 > welcomed by > all. A less invasive alternative would be to add something like this to =20 pervasives (taken from Leroy and R=E9my's unix course [1]) : let apply f x ~finally y =3D let res =3D try f x with exn -> finally y; raise exn in finally y; res The only quirk is that when you need to introduce a local or =20 anonymous function for the blocks, but I don't really care about that. However I'm tired of copying this function over and over in my io =20 intensive sources. Best, Daniel [1] =