One of the big differences between Erlang and Elixir is indeed that Elixir allows you to write macros in the language itself, using quote / unquote constructs just like lisps.
This makes it easy to generate code on compile time, which is then executed in runtime without any performance penalty.
A large part of Elixir itself is actually implemented as macros. For instance, the "unless" construct:
defmacro unless(condition, do: do_clause, else: else_clause) do
quote do
if(unquote(condition), do: unquote(else_clause), else: unquote(do_clause))
end
end
This makes it easy to generate code on compile time, which is then executed in runtime without any performance penalty.
A large part of Elixir itself is actually implemented as macros. For instance, the "unless" construct:
(code simplified for clarity)