Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] assert caught by try with _
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Michal Moskal <malekith@p...>
Subject: Re: [Caml-list] assert caught by try with _
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