Proposal: Document that Code.ensure_* won't work as expected on certain cases of umbrella

28 views
Skip to first unread message

charlott...@gmail.com

unread,
Mar 30, 2017, 7:54:25 PM3/30/17
to elixir-lang-core
I created a repo to represent this problem: https://github.com/mememori/umbrella_code_compile

On that repo we have a simple umbrella application that has child apps A and B.

A is usually compiled first thanks to implicit alphabetical ordering of child deps compilation.

A tries to use Code.ensure_compiled(B) and that will always fail (thanks to the ordering of compilation and the fact that, as they are technically different erlang applications on different paths, A doesn't have access to B's files) unless i explicitly put B as a dependency of A on A's mixfile (in that case the file will already be compiled so it'll return a truthy value).

My proposal is to document on Code.ensure_loaded that it can't trespass the limit of the application it is in and that, in cases where you want to ensure that a sibling application has a module, you'd have to explicitly make that sibling application a dependency

José Valim

unread,
Mar 30, 2017, 8:01:40 PM3/30/17
to elixir-l...@googlegroups.com
I have pushed improvements to master, thank you.



José Valim
Skype: jv.ptec
Founder and Director of R&D

--
You received this message because you are subscribed to the Google Groups "elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-core+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/faebdcc1-dad9-4f4d-aa4f-6f1ca7e1a519%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

charlott...@gmail.com

unread,
Mar 30, 2017, 9:42:28 PM3/30/17
to elixir-lang-core, jose....@plataformatec.com.br
Thanks for the fast resolution and for being awesome 😁
:heart: :green_heart: :blue_heart: :yellow_heart: :purple_heart:


On Thursday, March 30, 2017 at 9:01:40 PM UTC-3, José Valim wrote:
I have pushed improvements to master, thank you.



José Valim
Skype: jv.ptec
Founder and Director of R&D

On Fri, Mar 31, 2017 at 8:54 AM, <charlott...@gmail.com> wrote:
I created a repo to represent this problem: https://github.com/mememori/umbrella_code_compile

On that repo we have a simple umbrella application that has child apps A and B.

A is usually compiled first thanks to implicit alphabetical ordering of child deps compilation.

A tries to use Code.ensure_compiled(B) and that will always fail (thanks to the ordering of compilation and the fact that, as they are technically different erlang applications on different paths, A doesn't have access to B's files) unless i explicitly put B as a dependency of A on A's mixfile (in that case the file will already be compiled so it'll return a truthy value).

My proposal is to document on Code.ensure_loaded that it can't trespass the limit of the application it is in and that, in cases where you want to ensure that a sibling application has a module, you'd have to explicitly make that sibling application a dependency

--
You received this message because you are subscribed to the Google Groups "elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-co...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages