caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Xavier Leroy <Xavier.Leroy@inria.fr>
To: sumii@ecei.tohoku.ac.jp
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] line number in exception history?
Date: Tue, 11 Oct 2005 11:09:22 +0200	[thread overview]
Message-ID: <434B8142.5000407@inria.fr> (raw)
In-Reply-To: <a4d0794e0510091922r14b715f2kdfb6adc56fab30b8@mail.gmail.com>

> A student in Tokyo (_not_ CS major!) reported a "problem" (see below)
> of ocaml in his blog.  I guess it is because the line/character
> numbers point to the _head_ of the expression that _follows_ where the
> exception went through.  Is this a feature or a bug?

Your code is strange: you do realize that
     raise (invalid_arg "Give me positive!")
is weird because invalid_arg is a function that raises an exception itself?

Assuming that was intended, the backtrace is indeed slightly
inaccurate in two ways:

> Raised at file "pervasives.ml", line 22, character 17

That is correct.

> Re-raised at file "foo.ml", line 3, character 46

That should be "Called from file" but I guess the enclosing "raise"
confused the backtrace printer.

> Called from file "main.ml", line 3, character 2

This is indeed off by one line.  In general, the location following the
function call is reported, i.e

         function_that_raises arg1 arg2 arg3
                                            ^
                                            reported location

while in your example the following "in \n" is skipped.  Maybe one of
us will look at this, but I don't fell it's a big issue.

- Xavier Leroy


  parent reply	other threads:[~2005-10-11  9:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-10  2:22 Eijiro Sumii
2005-10-10  3:24 ` Eijiro Sumii
2005-10-11  9:09 ` Xavier Leroy [this message]
2005-10-11 11:13   ` [Caml-list] " Eijiro Sumii

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=434B8142.5000407@inria.fr \
    --to=xavier.leroy@inria.fr \
    --cc=caml-list@yquem.inria.fr \
    --cc=sumii@ecei.tohoku.ac.jp \
    /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).