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

Ahmed Ali <>
Tue Aug 26 01:34:26 CEST 2008


Hi All,

This discussion is interesting. Just wanted to know if it is possible
to get the function that called current function. Is this possible?

Best regards,

Ahmed Al-Issaei

On Mon, Aug 25, 2008 at 10:57 AM, Mats Cronqvist
<> wrote:
> Ulf Wiger wrote:
>> I should perhaps bring special notation to the smiley at the
>> end of my message. (:
>>
>> Whether or not the solution is cool is surely a matter of
>> taste - but I believe that the one who first came up with it
>> was Mats Cronqvist, the champion of obfuscated Erlang
>> code. (:
>>
>  thanks for the endorsement...
>
>  for the record, i have since moved on to using this:
> -define(position,[process_info(self(),current_function),{line,?LINE}]).
>
>  sometimes adding this:
> proplists:lookup(source,?MODULE:module_info(compile)).
>
>  mats
> _______________________________________________
> erlang-questions mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-questions
>



More information about the erlang-questions mailing list