Print the current line in elixir source code

In the elixir, we have Pseudo-Variables __MODULE__, __DIR__et al. Erlang also has a function to get the current line using the erlang macro.

How to get the current line of a file in elixir.

Sort of

IO.puts __LINE__
+4
source share
1 answer

Everything inside __ENV__:

IO.puts __ENV__.file
IO.puts __ENV__.line

Also see http://elixir-lang.org/docs/stable/elixir/Macro.Env.html

+5
source

Source: https://habr.com/ru/post/1609471/


All Articles