The Path clarity RFC says:
Rather than using
crateas a visibility specifier, we could use something like
local. (If we used it purely as a visibility specifier, we could make it a contextual keyword). That might be preferable, since
localis an adjective and is arguably more intuitive. This is an unresolved question.
What is the exact status of this question? The RFC pull request discussion barely touches this topic. I couldn’t find any other disscussions related to it. What is the rationale behind replacing
It may be that it’s just a novelty thing and everyone will get used to it eventually, like everyone got used to C++'s
protected. However, right now it just seems scary that Rust will get this change.
crate as a visibility modifier is not readable and not intuitive.
crate X means “X is a crate” for me. While it’s true that the syntax is unambiguous and you can tell that it’s a type or a field and not a crate, overall this change makes Rust code harder to understand, especially to newcomers. I imagine it can ultimately result in questions like “what is a crate in Rust? Judging by the code, types and fields can also be crates”.
I understand that choosing a better name and making a contextual keyword for it may take more work. However, just using a vaguely related existing keyword doesn’t seem like a reasonable way to go at all. So if making a new contextual keyword is not desired right now, why not just stick with
pub(crate)? When it was introduced, I didn’t feel any confusion. It was immediately clear what it does. What benefit does
crate have over
pub(crate)? Is it worth the additional confusion and entry barrier?