From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 7548EBC48 for ; Mon, 7 Mar 2005 14:29:46 +0100 (CET) Received: from ptb-relay03.plus.net (ptb-relay03.plus.net [212.159.14.214]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j27DTjU5001474 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 7 Mar 2005 14:29:46 +0100 Received: from [80.229.56.224] (helo=chetara) by ptb-relay03.plus.net with esmtp (Exim) id 1D8IIr-000AZw-5b for caml-list@yquem.inria.fr; Mon, 07 Mar 2005 13:29:45 +0000 From: Jon Harrop Organization: Flying Frog Consultancy Ltd. To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Re: exception safety / RAII ? Date: Mon, 7 Mar 2005 13:30:48 +0000 User-Agent: KMail/1.7.1 References: <293072a520e3724a0497e6456a8675be@mac.com> <200503070003.52747.jon@jdh30.plus.com> <874qfofdho.fsf-monnier+gmane.comp.lang.caml.inria@gnu.org> In-Reply-To: <874qfofdho.fsf-monnier+gmane.comp.lang.caml.inria@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200503071330.49084.jon@jdh30.plus.com> X-Miltered: at nez-perce with ID 422C5749.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 garbage:01 finalizers:01 finalisers:01 ocaml:01 frog:98 wrote:01 wrote:01 exception:01 writes:01 caml:02 filesystem:02 objective:02 rarely:02 deallocate:03 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 Monday 07 March 2005 01:32, 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. Yes, this may go wrong under certain circumstances (it is not a guarantee) but I very rarely have problems with this. On Monday 07 March 2005 03:31, Michael Walter wrote: > I'm not sure one should think of it as a "poor man's" solution or an > "alternative to GC". An indication to that could be the inclusion of > "using" into C#. I don't know C#, but when would you want to deallocate a resource before all references to it have disappeared? > Another indication could be the inelegance of > finalizers (or as well the trouble people seem to have using them -- I > wouldn't blame a wrong (read: C++) context as a cause for that). How are finalisers inelegant? Apart from referencing an object from its own finaliser, what problems do people have? -- Dr Jon D Harrop, Flying Frog Consultancy Ltd. Objective CAML for Scientists http://www.ffconsultancy.com/products/ocaml_for_scientists