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 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 3EBDBBC6C for ; Mon, 28 Jan 2008 17:06:41 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAK+MnUfAXQImh2dsb2JhbACQKgEBAQgKKZpU X-IronPort-AV: E=Sophos;i="4.25,260,1199660400"; d="scan'208";a="21894758" Received: from discorde.inria.fr ([192.93.2.38]) by mail4-smtp-sop.national.inria.fr with ESMTP; 28 Jan 2008 17:06:40 +0100 Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id m0SG6cSD029805 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Mon, 28 Jan 2008 17:06:40 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAADeMnUfBvsFJh2dsb2JhbACQKgEBAQgKKZpT X-IronPort-AV: E=Sophos;i="4.25,260,1199660400"; d="scan'208";a="6663086" Received: from hedwig2.umh.ac.be (HELO hedwig1.umh.ac.be) ([193.190.193.73]) by mail2-smtp-roc.national.inria.fr with ESMTP; 28 Jan 2008 17:06:38 +0100 Received: from poincare.swapping.umh.ac.be ([10.102.100.12]) by hedwig1.umh.ac.be (8.14.2/8.14.2) with ESMTP id m0SG74C14059328; Mon, 28 Jan 2008 17:07:05 +0100 Received: from localhost ([127.0.0.1] ident=trch) by poincare.swapping.umh.ac.be with esmtp (Exim 4.68) (envelope-from ) id 1JJWUs-0004Hn-KT; Mon, 28 Jan 2008 17:06:10 +0100 Date: Mon, 28 Jan 2008 17:06:10 +0100 (CET) Message-Id: <20080128.170610.265034237530039453.Christophe.Troestler+ocaml@umh.ac.be> To: caml-list@inria.fr Subject: Re: [Caml-list] [OSR] OCaml Standard Recommandation Process From: Christophe TROESTLER In-Reply-To: <200801281525.12651.jon@ffconsultancy.com> References: <200801281204.00689.jon@ffconsultancy.com> <479DE545.9050306@janestcapital.com> <200801281525.12651.jon@ffconsultancy.com> X-Face: #2fb%mPx>rRL@4ff~TVgZ"<[:,oL"`TUEGK/[8/qb58~C>jR(x4A+v/n)7BgpEtIph_neoLKJBq0JBY9:}8v|j Organization: University of Mons-Hainaut X-Mailer: Mew version 5.2.52 on Emacs 22.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.1 (www dot roaringpenguin dot com slash mimedefang) X-Miltered: at discorde with ID 479DFD8E.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ocaml:01 christophe:01 troestler:01 christophe:01 troestler:01 ocaml:01 translated:01 cheers:01 wrote:01 caml-list:01 umh:01 binding:02 binding:02 external:03 deallocate:03 On Mon, 28 Jan 2008 15:25:12 +0000, Jon Harrop wrote: > > So you write a "use" binding: > > let read_first_line file = > use ch = open_in file in > input_line ch > > and it gets translated into: > > let read_first_line file = > let ch = open_in file in > try input_line ch finally > ch#dispose > > where the "dispose" method that was automatically inserted at the end of the > scope of the "use" binding calls "close_in" in this case to deallocate the > external resource (a file handle in this case but it could be anything with a > dispose method). What is wrong with let read_first_line file = with_open_in file begin fun ch -> input_line ch end ? Cheers, ChriS