Looking at the code of Elixir and Ecto core I found some files that have
require directives in multiple places.
- Some have them outside the module: https://github.com/elixir-ecto/ecto/blob/master/lib/ecto/association.ex#L1
- Some have them inside the module: https://github.com/elixir-ecto/ecto/blob/master/lib/ecto/migrator.ex#L23-L26
- And some have a mix of inside and outside: https://github.com/elixir-lang/elixir/blob/master/lib/elixir/lib/float.ex
I know that those directives are lexically scoped, but I’m afraid I don’t understand the differences between using them outside or inside the module.
What advantages/disadvantages has one form and the other? Is there a preferred way to go? When should I use one or the other?