Manishearth / namespacing-rfc

RFC for Packages as Optional Namespaces
48 stars 3 forks source link

Unresolved: Feature syntax #4

Open Manishearth opened 4 years ago

Manishearth commented 4 years ago

Features can be specified as crate/feature, which makes foo/bar ambiguous with "feature bar of crate foo" and "optional crate `foo/bar".

We need a way to resolve ambiguity in the feature syntax

Manishearth commented 4 years ago

My proposal is that foo/bar is always "feature bar of crate foo" (and it will provide a helpful error message when foo/bar exists but foo does not), and if you want to enable a namespaced crate, you use foo/bar/

Manishearth commented 4 years ago

This doesn't quite fix the situation where you have foo/bar/baz which can either be foo/bar feature baz or foo feature bar/baz. This seems rare in practice, we can just pick one (foo/bar feature baz IMO since foo/bar AND bar/baz existing in the same deptree seems unlikely) and if you want the other one you explicitly define a feature. Alternatively we require an extra slash, i.e. foo/bar//baz

pksunkara commented 4 years ago

Continuing from this comment:

With the proposal of separator being :, there will no more disambiguates:

Manishearth commented 2 years ago

(Colons are no longer free to use, see https://doc.rust-lang.org/nightly/cargo/reference/features.html#optional-dependencies)

pksunkara commented 2 years ago

Not a big blocker, we can make it ::