-
-
Save alco/7785628 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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