caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Hendrik Tews <tews@tcs.inf.tu-dresden.de>
To: caml-list@inria.fr
Subject: Re: Assert
Date: Mon, 6 Nov 2000 18:51:22 +0100 (MET)	[thread overview]
Message-ID: <200011061751.SAA08361@ithif20.inf.tu-dresden.de> (raw)
In-Reply-To: <20001103113752.51773@pauillac.inria.fr>

Hi,

Xavier Leroy writes:
   From: Xavier Leroy <Xavier.Leroy@inria.fr>
   Date: Fri, 3 Nov 2000 11:37:52 +0100
   Subject: Re: Assert
   
   > List,
   >     I still cannot figure out why the assert instruction
   > does not return the line number at which the exception occures.
   
   Basically, it's because the compiler uses character numbers
   internally; line numbers are computed only when printing an error message.
   
>From what I can see from the sources, for every error and warning
message the whole source file is parsed again with a special
lexer to determine the line number (parsing/linenum.mll). Could
anybody comment on this approach to printing error messages? (It
seems very very very strange to me.)


Besides that I have another suggestion for the 
this discussion thread about escaping assertions:

Would it be possible to reserve a keyword (or a standard library
symbol) "current_line_number" that, by magic, expands to its
location (a tuple or triple of integers) in the source file? This
way the magic of assert would be available for us users, one
could write

try ....
with 
  ...
  | a -> prerr_endline( "Exception " ^ (Printexc.to_string a) ^ 
                        " escaping at " ^ 
                        ( ... current_line_number))


Bye,

Hendrik



  reply	other threads:[~2000-11-06 22:21 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-11-02 20:32 Assert Ohad Rodeh
2000-11-03  9:51 ` Assert Chris Hecker
2000-11-03 17:31   ` Assert Stefan Monnier
2000-11-03 10:33 ` Assert Nicolas barnier
2000-11-03 10:37 ` Assert Xavier Leroy
2000-11-06 17:51   ` Hendrik Tews [this message]
2000-11-07  9:21     ` Assert Xavier Leroy
  -- strict thread matches above, loose matches on Subject: below --
2000-11-03 12:02 Assert Damien Doligez
2000-10-31 18:50 Where did the exception occur? with Not_found -> assert false Mattias Waldau
2000-11-02 14:53 ` Assert Ohad Rodeh
2000-11-02 18:45   ` Assert Nicolas barnier
2000-11-03 17:34     ` Assert John Max Skaller

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=200011061751.SAA08361@ithif20.inf.tu-dresden.de \
    --to=tews@tcs.inf.tu-dresden.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).