Macros that define functions: conversions between an atom and an AST leaf that is an atom

Your examples are fine.

This may be shorter, but may not be better:

  defmacro config2({name, _, []}) do
    quote do
      def unquote(name)(), do: unquote(name)
    end
  end
1 Like