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 discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 50664BC0B for ; Mon, 15 Jan 2007 23:40:21 +0100 (CET) Received: from smtp12.orange.fr (smtp12.orange.fr [193.252.22.20]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l0FMeK1B017649 for ; Mon, 15 Jan 2007 23:40:21 +0100 Received: from [192.168.1.163] (ALagny-153-1-39-211.w86-212.abo.wanadoo.fr [86.212.250.211]) by mwinf1212.orange.fr (SMTP Server) with ESMTP id 81F2E1C000A1 for ; Mon, 15 Jan 2007 23:40:16 +0100 (CET) X-ME-UUID: 20070115224016532.81F2E1C000A1@mwinf1212.orange.fr Mime-Version: 1.0 (Apple Message framework v749.3) In-Reply-To: <20070115222736.GB9982@snarc.org> References: <45A87011.8080203@gmail.com> <20070115000544.GA28731@snarc.org> <200701152130.44615.jon@ffconsultancy.com> <81E583BC-438F-41C7-A940-6DF083763845@epfl.ch> <20070115222736.GB9982@snarc.org> Content-Type: text/plain; charset=ISO-8859-1; delsp=yes; format=flowed Message-Id: Content-Transfer-Encoding: quoted-printable From: =?ISO-8859-1?Q?Qu=F4c_Peyrot?= Subject: Re: Try finally (was Re: [Caml-list] Ocaml compiler features) Date: Mon, 15 Jan 2007 14:40:13 -0800 To: caml-list@yquem.inria.fr X-Mailer: Apple Mail (2.749.3) X-Miltered: at discorde with ID 45AC02D4.002 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; lrde:01 ocaml:01 compiler:01 0100,:01 bunzli:01 pervasives:01 remy's:01 exn:01 exn:01 trivial:01 ocaml:01 trivial:01 2007,:98 unix:01 wrote:01 On Jan 15, 2007, at 2:27 PM, Vincent Hanquez wrote: > On Mon, Jan 15, 2007 at 11:13:58PM +0100, Daniel B=FCnzli wrote: >> A less invasive alternative would be to add something like this to >> 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 >> anonymous function for the blocks, but I don't really care about =20 >> that. >> >> However I'm tired of copying this function over and over in my io >> intensive sources. > > This is exactly my point. > > I have this kind of trivial function spread over and over again. > and lots of people have this function as well, maybe a bit different, > slightly imcompatible with each other. > > Coding with OCaml would be some much easier if all those trivia would > come directly with the STANDARD distribution. and it would be much =20 > more > consistant across 2 differents developers as well. I don't know for the other trivial functions, but this apply function =20= looks like Std.finally from extlib. I hardly miss any trivial functions when using extlib, mileage might =20 vary. --=20 Best Regards, Qu=F4c=