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 7C1D9BC48 for ; Wed, 9 Mar 2005 23:30:48 +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 j29MUm6m022797 for ; Wed, 9 Mar 2005 23:30:48 +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 XAA29852 for ; Wed, 9 Mar 2005 23:30:47 +0100 (MET) Received: from qrnik.knm.org.pl (paf87.warszawa.sdi.tpnet.pl [217.96.225.87]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j29MUk0B022789 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO) for ; Wed, 9 Mar 2005 23:30:47 +0100 Received: from qrczak by qrnik.knm.org.pl with local (Exim 3.36 #1) id 1D99hR-0001GW-00 for caml-list@inria.fr; Wed, 09 Mar 2005 23:30:41 +0100 To: caml-list@inria.fr Subject: Re: [Caml-list] Re: exception safety / RAII ? X-Face: OW>RV&gN+&b-aiNY|U)f=S%w+/rK!);f>/W9IXg})]&F>ht.1Up8@04+_!gOp(_/l_-+E^. 2\vI)1=D,%HWiq)r(M/V~dr^5T^KF/[w5YZ4<0Sus3+O>l3uA/&W_21m?.s,Po8{pb0@ References: <293072a520e3724a0497e6456a8675be@mac.com> <877e9a1705030710476502ad31@mail.gmail.com> <1110281592.680.102.camel@localhost> <200503081828.44579.jon@jdh30.plus.com> <87u0nk98df.fsf-monnier+gmane.comp.lang.caml.inria@gnu.org> From: "Marcin 'Qrczak' Kowalczyk" Mail-Followup-To: caml-list@inria.fr Date: Wed, 09 Mar 2005 23:30:41 +0100 In-Reply-To: <87u0nk98df.fsf-monnier+gmane.comp.lang.caml.inria@gnu.org> (Stefan Monnier's message of "Wed, 09 Mar 2005 10:05:26 -0500") Message-ID: <87oeds4fla.fsf@qrnik.zagroda> User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: "Marcin 'Qrczak' Kowalczyk" X-Miltered: at concorde with ID 422F7918.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 422F7916.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 umontreal:01 api:01 minor:01 deallocation:01 imho:01 semantics:01 ocaml:01 freeing:98 exception:01 writes:01 exceptions:01 exceptions:01 explicitly:01 asynchronous:03 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on yquem.inria.fr X-Spam-Status: No, score=0.1 required=5.0 tests=FORGED_RCVD_HELO autolearn=disabled version=3.0.2 X-Spam-Level: Stefan Monnier writes: > Having a GC gives you a freedom when designing an API that is completely > incomparable to the minor convenience of not having to explicitly > close files. Compare the success of C++ destructors to deal with > file-closing and the insufficiency of those same destructors to deal with > object deallocation (leading to the never ending use of reference counting > and/or explicit copying). The fact that GC is useful for freeing memory doesn't imply that we should have no convenient way for closing files. IMHO there should be something similar to C# 'using', especially given that the GC will not close dropped files. The current semantics of C# 'using' is not enough in the presence of asynchronous exceptions. If OCaml wants to ever have reliable asynchronous exceptions, its 'using' should have three distinguished parts: acquire the resource, use it, and release it. -- __("< Marcin Kowalczyk \__/ qrczak@knm.org.pl ^^ http://qrnik.knm.org.pl/~qrczak/