From: Pierre Weis <weis@pauillac.inria.fr>
To: ajenkins@cs.umass.edu (Adam P. Jenkins)
Cc: caml-list@pauillac.inria.fr
Subject: Re: Assert_failure exception
Date: Mon, 1 Dec 1997 11:17:25 +0100 (MET) [thread overview]
Message-ID: <199712011017.LAA19058@pauillac.inria.fr> (raw)
In-Reply-To: <199712010149.UAA02524@cmpsci13.cs.umass.edu> from "Adam P. Jenkins" at "Nov 30, 97 08:49:51 pm"
> Date: Sun, 30 Nov 1997 20:49:51 -0500
> From: "Adam P. Jenkins" <ajenkins@cs.umass.edu>
>
> I noticed that the Assert_failure exception is defined as
>
> exception Assert_failure of (string * int * int)
>
> but the arguments don't seem to be used for anything meaningful. More
> importantly, the "assert" statement gives no indication of where it
> was called from, or what expression it was called on.
The argument of exception Assert_failure is used to report the file
name and the characters that bound the assert statement in the file.
> Since assert
> seems to be a language level statement, it could actually set the
> string argument of Assert_failure to a string representation of the
> asserted expression when it fails.
>
> Now:
>
> # assert (1 = 2);;
> Uncaught exception: Assert_failure(_)
>
> What I'd like to see:
>
> # assert (1 = 2);;
> Uncaught exception: Assert_failure("1 = 2")
>
> Do you plan to add anything like this? For me, the fact that the
> Assert_failure exception gives me no indication of where it was raised
> makes me unlikely to use the assert statement.
>
> Sorry I can't post in French.
>
> Adam
There should be a small ``misfeature'' in the toplevel interactive
system that does not report properly the location of the assertion. If
you use the compiler, you get
lat: ~: cat tmp.ml
assert ( 1 = 2 );;
lat: ~: ocamlc tmp.ml
lat: ~: a.out
Fatal error: uncaught exception Assert_failure("tmp.ml", 0, 16)
That's what you expected, no ?
The modification you suggested could be interesting, although it seems
to me to be strictly less powerful than the actual implementation of
assert (assuming the toplevel misfeature be corrected).
All the best,
Pierre Weis
INRIA, Projet Cristal, Pierre.Weis@inria.fr, http://pauillac.inria.fr/~weis/
parent reply other threads:[~1997-12-01 10:18 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <199712010149.UAA02524@cmpsci13.cs.umass.edu>]
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=199712011017.LAA19058@pauillac.inria.fr \
--to=weis@pauillac.inria.fr \
--cc=ajenkins@cs.umass.edu \
--cc=caml-list@pauillac.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