Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- defmodule Foo do
- defmacro import_sibbling(name) do
- quote do
- __MODULE__
- |> Module.split()
- |> List.delete_at(-1)
- |> List.insert_at(-1, unquote(name))
- |> Module.concat()
- |> import
- end
- end
- end
- defmodule MyApp.Bar do
- import Foo
- import_sibbling(Baz)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement