From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id D8620BB81 for ; Tue, 11 Oct 2005 11:09:24 +0200 (CEST) Received: from smtp1-g19.free.fr (smtp1-g19.free.fr [212.27.42.27]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j9B99Olx026383 for ; Tue, 11 Oct 2005 11:09:24 +0200 Received: from [192.168.1.2] (che78-2-82-237-71-191.fbx.proxad.net [82.237.71.191]) by smtp1-g19.free.fr (Postfix) with ESMTP id 2327C519A8; Tue, 11 Oct 2005 11:09:23 +0200 (CEST) Message-ID: <434B8142.5000407@inria.fr> Date: Tue, 11 Oct 2005 11:09:22 +0200 From: Xavier Leroy User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: sumii@ecei.tohoku.ac.jp Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] line number in exception history? References: In-Reply-To: X-Enigmail-Version: 0.91.0.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 434B8144.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 ocaml:01 bug:01 backtrace:01 pervasives:01 foo:01 enclosing:01 backtrace:01 blog:98 exception:01 exception:01 expression:01 slightly:02 confused:02 guess:02 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 > 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