Continuing the discussion from Revisiting modules, take 3:
Edited to add Question 0.
It looks like the
[other_crate]::path syntax has received some support so far.
I have two questions for everyone, about the particular case of
Should it be allowed at all?
Should the above be necessary to work with paths starting with
The alternative is to allow external crates to be accessed freely without any advance declaration, and there was some pushback against that idea in the “Automatically Usable External Crates” RFC, so I’d like to know if those concerns extend here as well.
Should the above allow paths in the form
EDIT: @RalfJung pointed out that the case I provided would actually be a special case, since
[std]:: is a mechanism for describing where the path is rooted, and not an item on its own. I.e. it’s analogous to
use super::something::in::parent;, where standalone
use super; is meaningless. So I now believe this special case shouldn’t be legal at all.
Under the line is the original text.
It would make little sense for both questions to have positive answer. That would mean that
use [std]; makes both
std:: work, leaving the choice of syntax up to personal tastes on every individual site. That’s bad for uniformity.
On the other hand, if both answers are negative, then
use [other_crate]; would be a no-op, and probably linted to avoid beginner confusion.
From stylistic standpoint, I think Question 2 should be negative, to promote uniformity. It would be somewhat unpleasant if some projects chose to follow style
[std]::io::Read while others chose
As for Question 1: Making explicit
use necessary would make it easy to determine crates used by the module just by reading the
use statements at the top, and I know some people would like that. On the other hand, it would mean more things to type, which some people would dislike.