hello guys
i’m trying to compile my module but i’m getting an error that info has to be called inside the module i am requiring another module.Here is the code :
defmodule CallersContext do
defmacro definfo do
IO.puts("In macro's context (#{__MODULE__}).")
quote do
IO.puts("In caller's context (#{__MODULE__}).")
def friendly_info do
IO.puts("""
My name is #{__MODULE__}
My functions are #{inspect(__info__(:functions))}
""")
end
end
end
end
defmodule Mod do
require CallersContext
CallersContext.definfo()
__info__(:CallersContext)
end
I’ve tried calling module.info but seems my implementation is incorrect. Advice on the correct way to require a module inside another module