English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] line number for assert
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2001-09-11 (10:52)
From: Sven <luther@d...>
Subject: Re: [Caml-list] line number for assert
On Tue, Sep 11, 2001 at 11:51:50AM +0200, David Mentre wrote:
> "Vesa Karvonen" <vesa.karvonen@housemarque.fi> writes:
> > The assert primitive of Ocaml 3.02 (windows version) seems to print the source
> > file location as an offset from the beginning of the file rather than as a
> > line number and column.
> > 
> > Is there a particular reason for this?
> Yes. Internally, the compiler knows only about character position. The
> line number is computed (in fact the source file is reparsed) only when
> an error message is printed:
>   http://caml.inria.fr/archives/200011/msg00032.html
> > The reason why I'm asking this is that it makes it much more difficult to find
> > the right assertion on most editors.
> Except with emacs. :)
> > Is there a simple way to overcome this limitation?
> As far as I know, no. However you should look at mailing list
> archive. This topic has been discussed numerous times.

What about a little tool to be added to the ocaml distribution, which parses a
file, and convert the char number to line number + column. I guess, from what
is already done by the toplevel, that this would be trivial to implement, as
all the code for it is already written.


Sven Luther
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr