Override hygiene
defmodule Setter do
defmacro bind_name(string) do
quote do
!var(name) = unquote(string)
end
end
endspawn process
pid = spawn(fn -> :timer.sleep(4000) end)
Define a way to extend a module using Elixir’s common API of use and using
defmodule Assertion do
defmacro \_\_using\_\_(_options) do
quote do
import unquote(\_\_MODULE\_\_) def run do
IO.puts "Running the tests..."
end
end
end
enddefmodule MathTest do
use Assertion
end
Examine the final AST created by your macro
Macro.to_string(some_ast)