The Great Module Adventure Continues

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:

    1. all extern crates
    2. std (which is a special case of 1)
    3. crate pointing to the root of the current crate
    4. super pointing to the parent module
  • Paths in use and in function bodies are the same relative paths.

  • There's no syntactic form for absolute paths, no ::, no extern, 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 :slight_smile:

4 Likes