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 A12A9BC32 for ; Tue, 8 Mar 2005 22:33:57 +0100 (CET) Received: from [IPv6:::1] (yquem.inria.fr [128.93.8.37]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j28LXu25024454 for ; Tue, 8 Mar 2005 22:33:57 +0100 Mime-Version: 1.0 (Apple Message framework v619.2) In-Reply-To: <200503081828.44579.jon@jdh30.plus.com> References: <293072a520e3724a0497e6456a8675be@mac.com> <877e9a1705030710476502ad31@mail.gmail.com> <1110281592.680.102.camel@localhost> <200503081828.44579.jon@jdh30.plus.com> Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: Content-Transfer-Encoding: 7bit From: Damien Doligez Subject: Re: [Caml-list] Re: exception safety / RAII ? Date: Tue, 8 Mar 2005 22:34:03 +0100 To: caml-list X-Mailer: Apple Mail (2.619.2) X-Miltered: at nez-perce with ID 422E1A44.002 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; damien:01 damien:01 caml-list:01 finalisers:01 deallocation:01 finalizer:01 wrote:01 exception:01 doligez:01 doligez:01 seems:03 explicit:03 ugly:03 implicit:03 long:04 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 Mar 8, 2005, at 19:28, Jon Harrop wrote: > That seems most odd though. Is this for historical reasons - closing > files was > added long before object finalisers? It was done after thinking hard about the question. The answer is that the "close" system call has several effects. Resource deallocation is one of these effects, but it's not the only one. So when to close is almost always a decision that must be made by the programmer, and we don't want to encourage people to think otherwise. And it would be ugly to have both explicit (close function) and implicit (finalizer) closing of a file. -- Damien