Pre-RFC: User namespaces on crates.io

I like the proposal for reserving prefixes, like tokio-*. This could be reinforced by crates.io website displaying crates a with prefix as explicitly belonging to the prefix owner:

tokio-foo (owned by tokio-*)

Maybe there could be a microsyntax for this, i.e. if a crate belongs to tokio-* prefix, then tokio-foo can be written as tokio/foo (but continues to map to tokio_foo symbol in Rust source).


Combining idea of prefixing crates with a user name, and idea of crates-io helping namespace things:

If you name your crate with a prefix of $githubusername-, then crates.io could recognize this and automatically change the TOML snippet displayed on the crate page to:

[dependencies]
foo = { package = "jdoe-foo", version = "0" }

This could be combined with crates.io automatically reserving jdoe-* prefix for user who logs in with jdoe username (it will move crate name squatting to username squatting, but it will work as namespacing while keeping backwards compatibility).

8 Likes