--- Comment #26 from Jonathan Marler <johnnymar...@gmail.com> ---
After more pondering I believe I've been able to pin down the fundamental
TLDR: The current import semantics fundamentally break import order and module
To demonstrate let me describe current import semantics.
When the compiler sees this, it first checks if a module has been loaded whose
"module name" is `foo`. The important part is "if a module has been loaded".
If this check fails, then it falls back to searching the fileystem for a file
matching the import name. Note that when this occurs, the file that ends up
matching the import may not have a "module name" matching the name used to
import it. And this is the fundamental problem.
What this means is that based on what modules have previously been loaded
(either via previous modules or previous imports in the same file) the
semantics of the import change. In one case, the import causes a previously
loaded module to be imported, and in the other case, it will query the file
system for the module. Since module names don't have to match filenames, this
means that the same import can result in loading different modules. The
important distinction is that this change isn't caused by different command
line arguments, it's cause by changing the import order or the module order,
which breaks order invariance.