Relative paths in Rust 2018

I really like this because this achieves 1path and is very close to what I’ve proposed in The Great Module Adventure Continues, + ambiguity rules :slight_smile: !

Technical questions/points:

  • Am I correct that foo and self::foo are almost equivalent? self::foo won’t work, but foo work will only if foo is in prelude/extern crate.

  • Looks like an alternative formulation is “we add extern crates to prelude, overriding existing prelude items”.

  • After this proposal, you’ll almost never write self::, ::foo, which feels like a nice simplifications?

  • Behavior with respect to ::* imports should be specified. Currently, they shadow prelude and are shadowed by anything else.

  • Ambiguity rules are an interesting solution! I think it even might help with IDE performance, because you’ll be able to stop early during transitive imports resolution. However, we must specify how they work with type/value/macro namespaces? Is it an error to use regex when you have fn regex() in scope as well as an the regex extern crate?

6 Likes