There’s been a lot of chatter about adding namespaces to
crates.io recently, so apologies if this idea has already been discussed.
Allow packages to be used as namespaces in a way that is backwards compatible with the existing flat namespace.
The owners of a crate on
crates.io can add sub-crates which are referred to by the name ‘toplevelcrate/subcrate’ in Cargo.toml files. For example, instead of publishing
regex maintainers could have published
regex/syntax. This does not answer all concerns about squatting, but it does handle the case where squatting surrounds the ecosystem a popular crate like
piston develops around itself. You will still be able to publish a crate in the top level namespace, and it will still feel like the natural way of doing things.
There is a segment of the rust community that is very concerned about name squatting and abuse of the global namespace, and another segment of the community which is concerned about the increased friction that namespaces can bring. This proposal attempts to answer some of the concerns of the former, while retaining the low friction experience we currently have. This proposal keeps the focus on packages, which may have maintainers who come and go, over people. Personally, I tend to develop trust for and familiarity with a particular software package first, and then to gain trust for the maintainer(s), and the package-focus of the current system is one that I really like.
Concern: Mapping crates.io names to rust-language crate names
Slashes will be mapped to underscores in the same way that dashes currently are. This does mean that two different crates.io crates could map to the same rust language name, but I am skeptical that it will come up much.