5 ms·
Elixir has macros which work by accepting AST as data and returning transformed AST structures. It's difficult to work with them, but there are plenty of langua
by ghayes 9y ago
Elixir has macros which work by accepting AST as data and returning transformed AST structures. It's difficult to work with them, but there are plenty of languages that have first-class macros with more complex syntax. From [0]:
defmacro unless(clause, do: expression) do
quote do
if(!unquote(clause), do: unquote(expression))
end
end
[0] https://elixir-lang.org/getting-started/meta/macros.html https://elixir-lang.org/getting-started/meta/macros.html