I would recommend taking a step back. Injecting attributes from one module
into the other is almost never going to work because the compiler happens
in parallel. There is no guaranteed order of execution. B may not even be
available unless you require it, which, as you said, means it will be
Actually, I may have solve my problem by reversing everything. :p
On Tuesday, February 28, 2017 at 4:04:13 AM UTC-5, Brian Cardarella wrote:
>
> The problem is the compilation order. The relationship between mod A & B
> is being written in __before_compile__ for each module. mod A is using
>
The problem is the compilation order. The relationship between mod A & B is
being written in __before_compile__ for each module. mod A is using
Module.put_attribute(B, :requires, A) in its __before_compile__ then B
would do something like:
quote do
for mod <- @requires, do: require mod
end
Actually, if you invoke the other module explicitly, it should also be
enough to list it as a dependency and for Elixir/Mix to track it. Unless
you are somehow generating those module names dynamically. Here is a good
article on the topic:
"require OtherModule" should do it. If not, it is a bug in Mix or Elixir,
so please provide a mechanism to reproduce it so we can fix it. :)
*José Valim*
www.plataformatec.com.br
Skype: jv.ptec
Founder and Director of R
On Tue, Feb 28, 2017 at 9:55 AM, Brian Cardarella