Revisiting Rust's modules

Relative use paths are a non-starter because they are literally impossible to implement. The reason why they were changed is that Rust's name resolution system was really really broken. As in, you would add and remove imports and random other imports in totally unrelated files would spuriously fail to resolve, simply because the compiler would try to resolve things in some order and bail out based on heuristics. I added the absolute path restriction because it was the only way I could actually fix name resolution in the rewrite.

ECMAScript 6 attempted a static module system based on relative imports and similarly had to give up because it was deemed unimplementable. As I recall, in fact, I went to @dherman for help, since he was working on a similar system for ES6 at the time, and he gave me the idea of absolute imports as a quick fix.

Be careful what you wish for.

5 Likes