[erlang-questions] How to get the line number of current executable code?
Thomas Lindgren
thomasl_erlang@REDACTED
Sun Aug 17 21:48:18 CEST 2008
--- On Sun, 8/17/08, Howard Yeh <hayeah@REDACTED> wrote:
> So you are basically providing a fall through case for
> M-F-A-line
> error report whenever there's branching? It sounds like
> a good way to
> do it.
Basically the transform tries to "elaborate" all the places where an exception can be thrown into providing more information, and the program then throws the new exception when it's encountered. (There are a few cases where the transform misses out: undefined function calls and, I seem to recall, exceptions when building binaries, at the very least.)
> I've read somebody (Joe?) saying that pattern matchings
> in erlang are
> like mini contracts. Early failure from failed match is a
> good thing.
> So I am wondering if Thomas's code transfomer is
> compatible with the
> Erlang philosophy (I think it is). But I may be missing the
> obvious.
All that basic smart_exceptions does is provide more information about the causes of an exception, so I don't think it's incompatible with such a principle. ("The basic transform", you ask? In principle, smart_exceptions also permits you to insert and run arbitrary code at the point of an exception, a bit like Common Lisp's condition handlers. But that's not tested much, and probably a bit too much complication.)
Best,
Thomas
More information about the erlang-questions
mailing list