Created
March 7, 2015 02:23
-
-
Save asonge/a2f944f25b84d935cb53 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Bar do | |
use Foo | |
def("OMG") do | |
"ok" | |
end | |
end |
This file contains hidden or 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 Foo do | |
defmacro __using__(_opts \\ []) do | |
quote do | |
import Kernel, except: [def: 2] | |
import Foo, only: [def: 2] | |
end | |
end | |
defmacro def(name, opts) do | |
IO.inspect({name, opts}) | |
[] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment