<div dir="ltr">You should trust the macro. It must use a similar method to Python's because they are both compiled to bytecode and thus there wouldn't *really* be line numbers in either one. <br><br><div class="gmail_quote">
2008/8/15 devdoer bird <span dir="ltr"><<a href="mailto:devdoer2@gmail.com">devdoer2@gmail.com</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div>Thanks.</div>
<div> </div>
<div>How can I do this without macro? I know python supply some tools to determine the line number in run time,like inspect module. <br><br> </div>
<div><span class="gmail_quote">2008/8/16, Anders Nygren <<a href="mailto:anders.nygren@gmail.com" target="_blank">anders.nygren@gmail.com</a>>:</span><div class="Ih2E3d">
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;">2008/8/15 devdoer bird <<a href="mailto:devdoer2@gmail.com" target="_blank">devdoer2@gmail.com</a>>:<br>
> HI:<br>
><br>> I want to implement a function like "get_current_lineno()/0" to get the<br>> current line number of the calling point?<br>> Eg.<br>> .....<br>> ....<br>> io:format("current line is ~w\n",[get_current_lineno()])<br>
> .....<br>><br>> the above code will print the line number of the calling point in the source<br>> file.<br>><br>> How can I do this in erlang?<br><br>There is a predefined macro ?LINE that does that<br>
so<br>io:format("current line is ~w\n",[?LINE])<br><br>/Anders<br><br>> _______________________________________________<br>> erlang-questions mailing list<br>> <a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
> <a href="http://www.erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://www.erlang.org/mailman/listinfo/erlang-questions</a><br>><br></blockquote></div></div><br>
<br>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://www.erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://www.erlang.org/mailman/listinfo/erlang-questions</a><br></blockquote></div><br></div>