From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 AF874BC32 for ; Mon, 7 Mar 2005 03:43:24 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j272hOrI020924 for ; Mon, 7 Mar 2005 03:43:24 +0100 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id DAA09679 for ; Mon, 7 Mar 2005 03:43:23 +0100 (MET) Received: from herd.plethora.net (herd.plethora.net [205.166.146.1]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j272hLac020915 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Mon, 7 Mar 2005 03:43:23 +0100 Received: from bhurt.plethora.net (bhurt.plethora.net [205.166.146.49]) by herd.plethora.net (8.13.1/8.13.1) with ESMTP id j272hF9j027375 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 6 Mar 2005 20:43:18 -0600 (CST) Date: Sun, 6 Mar 2005 20:48:18 -0600 (CST) From: Brian Hurt X-X-Sender: bhurt@localhost.localdomain To: Stefan Monnier Cc: caml-list@inria.fr Subject: Re: [Caml-list] Re: exception safety / RAII ? In-Reply-To: <874qfofdho.fsf-monnier+gmane.comp.lang.caml.inria@gnu.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Miltered: at concorde with ID 422BBFCC.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 422BBFC9.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 garbage:01 ocaml:01 wrote:01 exception:01 exception:01 writes:01 explicitly:01 filesystem:02 brian:03 brian:03 unexpected:03 stream:04 probably:05 nfs:06 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.2 X-Spam-Level: On Sun, 6 Mar 2005, Stefan Monnier wrote: > > In most cases you probably won't care when a file is closed after writing to > > it, so you can just rely on the garbage collector. > > Very bad practice in (e.g.) an NFS world where the filesystem makes no > guarantee about file writes until you actually close the file. Ocaml does give you the close_out function to explicitly close an I/O stream. Closing on GC collection just catches the odd cases, like exiting the function unexpected (via an exception, for example). Brian