Skip to content

Commit 49e9d89

Browse files
author
José Valim
committed
Add code comments for compiler heuristic
1 parent abec905 commit 49e9d89

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lib/elixir/lib/kernel/parallel_compiler.ex

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,15 @@ defmodule Kernel.ParallelCompiler do
140140
on = waiting_on_without_definition(waiting, pid),
141141
do: {on, {pid, :not_found}}
142142

143+
# Instead of releasing all files at once, we release them in groups
144+
# based on the module they are waiting on. We pick the module being
145+
# depended on with less edges, as it is the mostly likely source of
146+
# error (for example, someone made a type). This may not always be
147+
# true though: for example, if there is a macro injecting code into
148+
# multiple modules and such code becomes faulty, now multiple modules
149+
# are waiting on the same module required by the faulty code. However,
150+
# since we need to pick something to be first, the one with fewer edges
151+
# sounds like a sane choice.
143152
entries =
144153
entries
145154
|> Enum.group_by(&elem(&1, 0), &elem(&1, 1))

0 commit comments

Comments
 (0)