Path searching

r.e. glob imports, the ‘inherit use’ idea,…

Imagine if on not finding a symbol , Rust did the following:-

[1] breadth-first search for it in submodules of the current module [2] step back to the parent, and repeat the search … (until you reach the root)

I’m guessing the objection would be that subsequent changes to a source base could break such ad-hoc symbol references , so this would leave projects in a brittle form if they relied on this

What if you enhanced this with a ‘fuzzy path match’ … e.g. std::Vec or vec::Vec would both locate std::vec::Vec in preference to a Vec in any other location - and made it a warning when a completely unqualified assumed path was being used.

Could this be better than the temptation toward indiscriminate glob imports - another way of reducing the micromanagement of modules & symbols, and sharing a lot of context between related files automatically

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.