Description
Related: #2
The current RFC lists slashes as the separator choice. They have some drawbacks
So far slashes as a "separator" have not existed in Rust. There may be dissonance with having another identifier character allowed on crates.io but not in Rust code. Dashes are already confusing for new users. Some of this can be remediated with appropriate diagnostics on when
/
is encountered at the head of a path.Furthermore, slashes are ambiguous in feature specifiers:
[dependencies] "foo" = "1" "foo/std" = { version = "1", optional = true } [features] # Does this enable crate "foo/std", or feature "std" of crate "foo"? default = ["foo/std"]
There are many other alternatives we could pick:
We could perhaps have
foo-*
get autoreserved if you publishfoo
, as outlined in https://internals.rust-lang.org/t/pre-rfc-hyper-minimalist-namespaces-on-crates-io/13041 . I find that this can lead to unfortunate situations where a namespace traditionally used by one project (e.g.async-*
) is suddenly given over to a different project (theasync
crate). Furthermore, users cannot trustfoo-bar
to be owned byfoo
because the vast number of grandfathered crates we will have.Another separator idea would be to use
::
, e.g.foo::bar
. This looks great in Rust code, provided that the parent crate is empty and does not also have abar
module. See the section above for more info.Triple colons could work. People might find it confusing, but
foo:::bar
evokes Rust paths without being ambiguous.We could use
~
which enables Rust code to directly name namespaced packages (as~
is no longer used in any valid Rust syntax). It looks extremely weird, however.We could use dots (
foo.bar
). This does evoke some similarity with Rust syntax, however there are ambiguities:foo.bar
in Rust code could either mean "the fieldbar
of local/staticfoo
" or it may mean "the cratefoo.bar
".Note that unquoted dots have semantic meaning in TOML, and allowing for unquoted dots would freeze the list of dependency subfields allowed (to
version
,git
,branch
,features
, etc).