Hello,
I'm new to PolyML and have some questions concerning debugging and erro= r messages.
The function PolyML.exception_trace prints a number behind each functio= n name in the stack trace. Could someone please tell me what this number indicat= es?
Is there a way to get the line number of the input file (like njml does= ) where a Match exception is thrown?
Thanks in advance, Frank
***********************************************************************=
Frank Rittinger Albert-Ludwigs Universit=E4t Freiburg, Institut f=FCr Informatik Georges-Koehler-Allee, Geb. 52 (Room 00-021), 79110 Freiburg, Germany Phone: +49 761 203 8245 Fax: +49 761 203 8242 URL: http://www.informatik.uni-freiburg.de/~rittinge ***********************************************************************=
Hi Frank,
The number after each function name is the number of arguments taken by the function. It's intended to provide some guide to which particular function is being referred to. The code for each function contains a string which is used both by exception_trace and by the profiling system. Generally, exception_trace can help to narrow down the source of an exception but only to the general area. Poly/ML does a lot of inline expansion and tail-recursion removal so the functions that are reported may not correspond exactly to those in the original source code.
You can get a more accurate idea of what's going on if you use the source-level debugger. See http://www.polyml.org/docs/Debugging.html . This does not have a specialised exception_trace (maybe it should have) but the "trace" function may help.
There's nothing in Poly/ML which will print the line number where a Match is raised - I haven't looked at how this works in NJML. You should, though, get warning messages when you compile the source indicating where the matches are non-exhaustive and so where you are likely to get a Match exception. When I'm writing ML I tend to make all my matches exhaustive and if there are cases which shouldn't occur I will insert something like raise Fail "foo-Invalid value".
David.
On Monday, May 13, 2002, at 07:15 , frittinger@acm.org wrote:
I'm new to PolyML and have some questions concerning debugging and error messages.
The function PolyML.exception_trace prints a number behind each function name in the stack trace. Could someone please tell me what this number indicates?
Is there a way to get the line number of the input file (like njml does) where a Match exception is thrown?