Skip to content

Instantly share code, notes, and snippets.

@asonge
Created March 7, 2015 02:23
Show Gist options
  • Save asonge/a2f944f25b84d935cb53 to your computer and use it in GitHub Desktop.
Save asonge/a2f944f25b84d935cb53 to your computer and use it in GitHub Desktop.
defmodule Bar do
use Foo
def("OMG") do
"ok"
end
end
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