Macros, Part 2 - Micro Theory
[3] (译) Understanding Elixir Macros, Part 3 - Getting into the AST
[4]..., x) do
:gen_server.cast(pid, {:inc, x})
end
def handle_cast({:inc, x}, state) do
{:noreply, state...让我们看一个关于函数的调用例子:
iex(3)> quote do div(5,4) end
{:div, [context: Elixir, import: Kernel], [5, 4]}
这类似于...我还引入(实际上, 是从 Elixir 源代码中复制粘贴了)guard 语句指定了宏能处理的运算符集(第 3 行). 这个检查有一个特殊原因....原文: https://www.theerlangelist.com/article/macros_3