Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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: Chris Hecker <checker@d...>
Subject: Re: [Caml-list] assert caught by try with _

>You could tell the same for stack overflow and some other kinds of
>exceptions. OCaml uniformly treat failures as exceptions, and that's the
>right thing to do. But catching exceptions with _ , without even printing
>them, is not the "right thing" and is definitly huge pain and error prone.

I totally disagree about assert being the same as a stack overflow in 
nature, but more importantly, you're ignoring the lessons learned from C++ 
and Java on the exception specification front.  You just don't know what 
exceptions code you call in a real program will throw in general.  There 
are plenty of times when you want to try something at runtime and just bail 
if it doesn't work, and you don't care about the specifics of why it didn't 
work.  A single "with _" will mask any assertions living below it, which 
seems to me to be a bad thing since by definition an assert is a 
development debugging tool.  Assert should just blow up, like in C (at 
least as an option).  You shouldn't have to remember to put a "with" clause 
in for it.


To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: