[erlang-questions] How to get the line number of current executable code?

Howard Yeh hayeah@REDACTED
Sun Aug 17 19:25:11 CEST 2008

On 8/17/08, Thomas Lindgren <thomasl_erlang@REDACTED> wrote:
> I'm not sure if this helps in your case, but if you're satisfied with getting line numbers in your exceptions, try smart_exceptions from jungerl. It's a parse transform, so it works without the debugger.

Ah, thanks for the pointer.

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.

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.

As mentioned, I am playing around with my pet lisp frontend. Having
seem Thomas's smart exception, it seems that it makes sense to provide
special syntatic support for matching failure. Something like,

(case X
  : "expected such and such input")

The last line is a syntatic sugar for a universal pattern that throws
a {badmatch...}, but with M-F-A/line and reason. Ditto with function
clauses et al.

Robert V. probably wouldn't like it : )

>  _______________________________________________
>  erlang-questions mailing list
>  erlang-questions@REDACTED
>  http://www.erlang.org/mailman/listinfo/erlang-questions

More information about the erlang-questions mailing list