Hm, this is a very neat idea! I am a little bit worried that extern crates and std work differently as a result of this: the fact that std is special-cased is one of the drawbacks of the current system.
However, what if we add all extern crates to the prelude? The system would work like this:
-
There are no absolute paths at all, every path starts relative to the current module.
-
By default, the namespace of each module includes:
- all extern crates
std(which is a special case of 1)cratepointing to the root of the current cratesuperpointing to the parent module
-
Paths in
useand in function bodies are the same relative paths. -
There's no syntactic form for absolute paths, no
::, noextern, no:. -
Usual shadowing rules apply.
I am totally not sure that this is a great idea, and I have not though out the transition paths, but it seems to be a proposal not mentioned before, and I find "absolute paths are hard? Get rid of absolute paths" approach neat ![]()