Re: [elixir-core:6975] [Proposal] @dependency_of

2017-02-28 Thread José Valim
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

Re: [elixir-core:6974] [Proposal] @dependency_of

2017-02-28 Thread Brian Cardarella
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 >

Re: [elixir-core:6973] [Proposal] @dependency_of

2017-02-28 Thread Brian Cardarella
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

Re: [elixir-core:6971] [Proposal] @dependency_of

2017-02-28 Thread José Valim
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:

Re: [elixir-core:6971] [Proposal] @dependency_of

2017-02-28 Thread José Valim
"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