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

Richard A. O'Keefe ok@REDACTED
Mon Aug 18 01:58:11 CEST 2008


On 17 Aug 2008, at 10:01 pm, Thomas Lindgren wrote:
> The basic problem is that epp works on the token level, not the  
> syntax tree level, so when you find ?FUNCTION there is no  
> information about what function you're in. (And figuring it out  
> seems like a thankless job.)
>
I note that while __FILE__, __LINE__, __DATE__, __TIME__ and so on are
macros in C, __func__ is not.  It is a keyword.  So the solution that
Thomas Lindgren proposes seems good.  I would prefer one mechanism that
solves several issues, so I suggest that instead of ?FUNCTION the thing
to have is ?LOCATION
  => {File, Line, Module, Function, Arity, Clause_Number}





More information about the erlang-questions mailing list