From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id WAA02569; Sun, 4 Jul 2004 22:24:43 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 WAA02749 for ; Sun, 4 Jul 2004 22:24:32 +0200 (MET DST) Received: from carrierpigeon.cs.umd.edu (carrierpigeon.cs.umd.edu [128.8.129.58]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i64KOUSH002549 for ; Sun, 4 Jul 2004 22:24:31 +0200 Received: from [192.168.1.101] (pcp09492462pcs.nrockv01.md.comcast.net [69.140.192.91]) (authenticated bits=0) by carrierpigeon.cs.umd.edu (8.12.10/8.12.5) with ESMTP id i64KOKpB028304 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NO); Sun, 4 Jul 2004 16:24:20 -0400 (EDT) In-Reply-To: <20040704073050.GA907@la.iki.fi> References: <20040628143917.GA21847@fichte.ai.univie.ac.at> <20040628173400.GB26193@fichte.ai.univie.ac.at> <1088470968.18587.123.camel@pelican.wigram> <20040704073050.GA907@la.iki.fi> Mime-Version: 1.0 (Apple Message framework v618) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <21A5580B-CDF8-11D8-B2E6-000D93C1F22A@cs.umd.edu> Content-Transfer-Encoding: 7bit Cc: caml-list@inria.fr From: Michael Hicks Subject: Re: [Caml-list] Exceptions considered harmful Date: Sun, 4 Jul 2004 16:24:20 -0400 To: Lauri Alanko X-Mailer: Apple Mail (2.618) X-Miltered: at concorde with ID 40E8677E.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 foo:01 foo:01 handler:01 exception:02 let:04 hicks:04 exceptions:04 mwh:08 approach:08 michael:08 something:09 U4:88 U4:88 setting:14 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > try > x <- foo () > in > bar () > unless > E1 -> handle1 () > E2 -> handle2 () The key part to this approach is that bar() is not covered by the exception handler. This allows the caller to communicate the successfully created value into bar() through x. In a traditional setting, you'd have something like let x := NONE; try x := SOME foo(); with E1 -> .... if !x <> NONE then bar !x else ?? Mike ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners