[erlang-questions] Re: Getting line number in backtrace?
Fri Dec 3 18:10:03 CET 2010
On Fri, Dec 3, 2010 at 8:22 AM, Thomas Lindgren <>wrote:
> My own view is that line numbers are hugely helpful. Ideally, I'd want all
> exceptions to contain that info and the entire call stack decorated.
> Unfortunately, there are some cases where a parse transform is powerless,
> so it
> would need compiler and/or VM support.
I strongly agree that VM-level support for this is wonderful, line numbers
for the entire callstack would be super awesomesauce, and that you can't do
this with a parse transform.
At one point I had worked on trying to decorate the entire call stack with
line numbers by wrapping every possible call site with try/catch and
specifically decorating special "exception" objects/terms.
Later I learned that will break tail recursion so I gave up. I don't think
there's any solution to decorating exceptions in this manner that could
possibly support mutual tail recursion. There are some ways to handle simple
tail recursion, i.e. an entry function that has the call sites wrapped that
calls a tail recursive version of the same function that doesn't.
I'm thinking VM-level support is the only real option.
More information about the erlang-questions