Hi, Ulisses
Right now your application wouldn’t compile if you have cyclic dependencies and
would scream at compile time.
Example:
# a.ex
defmodule A do
B.run()
end
# b.ex
defmodule B do
A.run()
end
Compile-time error message:
Compiling 2 files (.ex)
== Compilation error in file lib/b.ex ==
** (CompileError) deadlocked waiting on module A
lib/b.ex:2: (module)
(stdlib 3.14.2) erl_eval.erl:680: :erl_eval.do_apply/6
== Compilation error in file lib/a.ex ==
** (CompileError) deadlocked waiting on module B
lib/a.ex:2: (module)
(stdlib 3.14.2) erl_eval.erl:680: :erl_eval.do_apply/6
Compilation failed because of a deadlock between files.
The following files depended on the following modules:
lib/b.ex => A
lib/a.ex => B
Ensure there are no compile-time dependencies between those files and that the
modules they reference exist and are correctly named
> On 23 May 2021, at 01:35, alex via elixir-lang-core
> <[email protected]> wrote:
>
> I've spent 5 days untangling module deps in a huge Elixir codebase. I'm
> almost done, but I wish this problem didn't happen in the first place. I want
> the compiler to SCREAM at me if I've introduced a compile-time cyclic
> dependency.
>
> In the short term, my plan is to add a stage to the CI, which requires that
> `mix xref graph --format cycles --label compile` returns empty. This will be
> good for catching cycles before they get merged, but it would be even better
> if people could know as soon as it happens.
>
> Alex
>
>
> --
> 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 [email protected]
> <mailto:[email protected]>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/elixir-lang-core/d6c2f2b7510d787bd68d592993fa9841%40alexgleason.me
>
> <https://groups.google.com/d/msgid/elixir-lang-core/d6c2f2b7510d787bd68d592993fa9841%40alexgleason.me?utm_medium=email&utm_source=footer>.
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/elixir-lang-core/4FD5D496-61E5-4E3E-A38C-29220D3FE4D0%40achempion.com.