Skip to content

Instantly share code, notes, and snippets.

@StevenXL
Created June 9, 2016 12:48
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 StevenXL/268d3750b14d26c2a1e84bd4f92403cb to your computer and use it in GitHub Desktop.
Save StevenXL/268d3750b14d26c2a1e84bd4f92403cb to your computer and use it in GitHub Desktop.
Metaprogramming - Context
defmodule UseMacro do
use DefineMacro
end
defmodule DefineMacro do
defmacro __using__(_opts) do
IO.inspect __MODULE__ # DefineMacro
quote do
IO.inspect __MODULE__ #UseMacro
IO.inspect unquote(__MODULE__) #DefineMacro
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment