Macro.var
You're seeing just the function
var
, go back to Macro module for more information.
Specs
Generates an AST node representing the variable given
by the atoms var
and context
.
Note this variable is not unique. If you later on want
to access this same variable, you can invoke var/2
again with the same arguments. Use unique_var/2
to
generate a unique variable that can't be overridden.
Examples
In order to build a variable, a context is expected.
Most of the times, in order to preserve hygiene, the
context must be __MODULE__/0
:
iex> Macro.var(:foo, __MODULE__)
{:foo, [], __MODULE__}
However, if there is a need to access the user variable, nil can be given:
iex> Macro.var(:foo, nil)
{:foo, [], nil}