From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id PAA23165 for caml-red; Sun, 19 Nov 2000 15:53:59 +0100 (MET) 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 PAA28921 for ; Fri, 17 Nov 2000 15:37:35 +0100 (MET) Received: from cepheus.azstarnet.com (cepheus.azstarnet.com [169.197.56.195]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id eAHEbYj19135 for ; Fri, 17 Nov 2000 15:37:34 +0100 (MET) Received: from dylan (dialup10ip008.tus.azstarnet.com [169.197.34.136]) by cepheus.azstarnet.com (8.9.3/8.9.3) with SMTP id HAA24883 for ; Fri, 17 Nov 2000 07:37:31 -0700 (MST) X-Sent-via: StarNet http://www.azstarnet.com/ Message-ID: <004301c050a3$eea3d6e0$210148bf@dylan> From: "David McClain" To: Subject: Re: unwind-protect? Date: Fri, 17 Nov 2000 07:37:36 -0700 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 4.72.3110.5 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 Sender: weis@pauillac.inria.fr >Is there an equivalent of Lisp's `unwind-protect' or Java's >"try...finally"? Here is the version that I use. It expects two functions of no arguments -- one for the protected portion and one for cleanup that is invoked in any event. let unwind_protect fn exitfn = let rslt = try fn() with exn -> ignore(exitfn()); raise exn in ignore(exitfn()); rslt - D.McClain