caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Mattias Waldau" <mattias.waldau@abc.se>
To: "'james woodyatt'" <jhw@wetware.com>,
	"'Xavier Leroy'" <xavier.leroy@inria.fr>
Cc: "'The Trade'" <caml-list@inria.fr>
Subject: RE: [Caml-list] assert false and -noassert
Date: Sun, 24 Feb 2002 10:08:21 +0100	[thread overview]
Message-ID: <000001c1bd12$ceaab700$0700a8c0@gateway> (raw)
In-Reply-To: <E627BF22-261F-11D6-AAF7-000502DB38F5@wetware.com>

I totally support the current implementation, you NEVER want
a program to just terminate. At least you should be able to say
something like "Internal Error" and log it, and then terminate.

/mattias

P.s. I have observed that users really hate internal error 
messages, so nowadays I just log the error, and then try to 
restart the application. In this way the users will not even
detect that the application failed.

In most cases, they will not report this as an error, they
will just tell you when you ask, that the application behaved
strange, and that they found a workaround.

There exists probably some kind of psychological explanation
for their behaviour. For example that people are used to 
that other people sometimes behave strange, like lying, 
and they tolerate that. However, people would find it 
very strange if instead of answering, you just run away.



> -----Original Message-----
> From: owner-caml-list@pauillac.inria.fr 
> [mailto:owner-caml-list@pauillac.inria.fr] On Behalf Of james woodyatt
> Sent: Wednesday, February 20, 2002 5:36 PM
> To: Xavier Leroy
> Cc: The Trade
> Subject: Re: [Caml-list] assert false and -noassert
> 
> 
> On Monday, February 18, 2002, at 06:00 , Xavier Leroy wrote:
> > [I wrote:]
> >> While we are on the subject of the assert function, it occurs to me
> >> that
> >> it might be nice if -noassert together with "assert false" were to
> >> bypass all exception handling and go right into program 
> termination.  
> >> It
> >> seems to me that if I've used the -noassert option, I've 
> made a promise
> >> that the code compiled with it will never raise the Assert_failure
> >> exception.
> >
> > This is a topic that we've discussed at some point: is it 
> appropriate 
> > to map (conceptually) fatal errors (such as a failed 
> assertion) to an 
> > exception?  There is one pitfall with this approach, namely that a 
> > catch-all "try ... with x -> ..." might inadvertently hide 
> the fatal 
> > error.  On the other hand, the strenght of this approach is that it 
> > enables your program to clean up and possibly log a detailed error 
> > message before termination.
> 
> It *is* appropriate to map conceptually fatal errors (such as failed 
> assertions) to exceptions.  I have a library.  It contains 
> assertions.  
> I want to test it.  I have a list of thirty test functions.  
> I iterate 
> the list to apply all the functions to test the library, 
> wrapping each 
> one in a "try ... with x -> ..." clause.  Result: all thirty 
> functions 
> are applied, and I know how many of them raise the Assert_failure 
> exception.
> 
> At some point, I want to turn off the assertions.  My expectation is 
> that -noassert would then compile the library so that it never raises 
> the Assert_failure exception.  Unfortunately, the "assert false" case 
> is... well, an exception to the general rule.
> 
> That's why, when the -noassert flag is used, I would prefer 
> that "assert 
> false" map to an immediate program termination, á la 
> "abort()" in the C 
> language.  In fact, if that's what ocamlopt inserted in this 
> case, i.e. 
> a call to abort() in the C library, I would find that optimal.
> 
> 
> --
> j h woodyatt <jhw@wetware.com>
> "...the antidote to misinformation is more information, not less."
>                                                       --vinton cerf
> 
> -------------------
> 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

-------------------
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


  reply	other threads:[~2002-02-24  9:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-15 17:01 [Caml-list] assertions and branch prediction james woodyatt
2002-02-18 14:00 ` Xavier Leroy
2002-02-20 16:35   ` [Caml-list] assert false and -noassert james woodyatt
2002-02-24  9:08     ` Mattias Waldau [this message]
2002-02-25 20:00       ` james woodyatt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='000001c1bd12$ceaab700$0700a8c0@gateway' \
    --to=mattias.waldau@abc.se \
    --cc=caml-list@inria.fr \
    --cc=jhw@wetware.com \
    --cc=xavier.leroy@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).