caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Gerd Stolpmann <Gerd.Stolpmann@darmstadt.netsurf.de>
To: caml-list@inria.fr
Subject: Exceptions inside assertions
Date: Wed, 10 Nov 1999 01:06:57 +0100	[thread overview]
Message-ID: <99111001200402.23873@ice> (raw)

Hi, 

I have a problem with exceptions which are raised within the expression of an
assertion, e.g.

assert (raise Not_found)

The current behaviour is that the exception "falls through the assertion" which
may not be appropriate for some cases. For example, consider

assert (Queue.peek queue == current_element)

>From my point of view, the assertion expresses that "queue" has at least one
element and that this element is identical to "current_element". But if the
assertion is violated because the queue is empty, I only get a Queue.Empty
exception, and I do not see the reason for it. Perhaps I even catch
Queue.Empty, and the program continues, which is very hard to find out.

I suggest to introduce a new Assert_failure_by_exception exception to better
report this situation.

Gerd
--
----------------------------------------------------------------------------
Gerd Stolpmann      Telefon: +49 6151 997705 (privat)
Viktoriastr. 100             
64293 Darmstadt     EMail:   Gerd.Stolpmann@darmstadt.netsurf.de (privat)
Germany                     
----------------------------------------------------------------------------



             reply	other threads:[~1999-11-12  9:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-11-10  0:06 Gerd Stolpmann [this message]
1999-11-12 16:10 Damien Doligez

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=99111001200402.23873@ice \
    --to=gerd.stolpmann@darmstadt.netsurf.de \
    --cc=caml-list@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).