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 TAA26999; Wed, 6 Aug 2003 19:45:16 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id TAA32680 for ; Wed, 6 Aug 2003 19:45:15 +0200 (MET DST) Received: from ep09.kernel.pl (ep09.kernel.pl [212.87.11.162]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id h76HjDT15545 for ; Wed, 6 Aug 2003 19:45:14 +0200 (MET DST) Received: (qmail 19175 invoked by uid 566); 6 Aug 2003 17:45:11 -0000 Date: Wed, 6 Aug 2003 19:44:35 +0200 From: Michal Moskal To: caml-list@inria.fr Subject: Re: [Caml-list] assert caught by try with _ Message-ID: <20030806174435.GA22278@roke.freak> Mail-Followup-To: caml-list@inria.fr References: <4.3.2.7.2.20030728192639.025496d8@localhost> <4.3.2.7.2.20030728112622.02f3fef8@localhost> <00d301c3553b$9c01f030$ca00a8c0@warp> <4.3.2.7.2.20030728192639.025496d8@localhost> <4.3.2.7.2.20030729113455.02401e98@localhost> <20030806121941.GC2333@roke.freak> <20030806145020.GA18143@force.stwing.upenn.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030806145020.GA18143@force.stwing.upenn.edu> User-Agent: Mutt/1.4.1i X-PGP-Fingerprint: CF89 1B14 11BE 1CC9 2CA3 7497 5E32 69B4 BC71 B4C2 X-AntiVirus: scanned for viruses by AMaViS 0.2.1 (http://amavis.org/) X-Loop: caml-list@inria.fr X-Spam: no; 0.00; michal:01 moskal:01 malekith:01 pld-linux:01 caml-list:01 0400,:01 lovas:01 hecker:01 debugger:01 popping:01 bug:01 hard-coded:01 prerr:01 endline:01 chris:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Wed, Aug 06, 2003 at 10:50:21AM -0400, William Lovas wrote: > On Wed, Aug 06, 2003 at 02:19:41PM +0200, Michal Moskal wrote: > > On Tue, Jul 29, 2003 at 02:01:07PM -0700, Chris Hecker wrote: > > > Another way of thinking about this is that almost everybody re-#defines > > > assert in production C/C++ programs to do their own assert handling during > > > development (whether it's printing out additional information, allowing you > > > to drop into the debugger, popping up a message box, sending bug email, > > > whatever). With assert hard-coded into ocaml, you can't do this. > > > > try > > main () > > with Assert_failure (line, col, file) -> (* or whatever it is *) > > prerr_endline "Panic! Contact support" > > This won't trigger, though, if the exception has already been caught > upstream. Of course, that's what's wrong with [try ... with _ -> ...]. What I wanted to show is, that treating assert as an exception makes it possible to customize it (with standard features of the language). -- : Michal Moskal :: http://www.kernel.pl/~malekith : GCS {C,UL}++++$ a? !tv : When in doubt, use brute force. -- Ken Thompson : {E-,w}-- {b++,e}>+++ h ------------------- 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