Skip to content

Instantly share code, notes, and snippets.

@alco
Forked from Andy-Richards/gist:7785272
Last active December 30, 2015 05:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alco/7785628 to your computer and use it in GitHub Desktop.
Save alco/7785628 to your computer and use it in GitHub Desktop.
defmodule A do
defmacro __before_compile__(_env) do
funs = Enum.map([:a, :b], fn(name) ->
quote do
def unquote(name)(), do: unquote(name)
end
end)
quote do
unquote_splicing(funs)
end
end
end
defmodule B do
@before_compile A
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment