Advertisement
Guest User

Untitled

a guest
Aug 28th, 2015
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. defmodule Foo do
  2. defmacro __using__(_) do
  3. quote do
  4. if Module.get_attribute(__MODULE__, :already_done) do
  5. IO.inspect "already done"
  6. else
  7. IO.inspect "doing"
  8. @already_done true
  9. end
  10. end
  11. end
  12. end
  13.  
  14. defmodule Bar do
  15. use Foo
  16. use Foo
  17. use Foo
  18. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement