Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Alternatives to" links, appearing bidirectionally #3185

Closed
ijackson opened this issue Jan 16, 2021 · 3 comments
Closed

"Alternatives to" links, appearing bidirectionally #3185

ijackson opened this issue Jan 16, 2021 · 3 comments
Labels
C-enhancement ✨ Category: Adding new behavior or a change to the way an existing feature works

Comments

@ijackson
Copy link

Problem

I often find myself hunting through the crates.io search for a crate to solve a particular problem. Often there will be multiple possibilities, and in that case I would like to be able to find the relevant options and evaluate them side-by-side.

Currently this is quite difficult because it is difficult to find the alternatives. The very best crate authors discuss alternatives in their documentation but doing so is a lot of work, and the incentives to crate authors to do this are quite weak. So mostly I have to rely on the keyword search (or word of mouth, etc.).

Proposed solution

I have an idea for new piece of metadata from crate authors which I think they would be keen to provide, and which would help solve this problem.

I suggest a new metadata field (in Cargo.toml until #3167) something like this:

[package]
name = 'my_slotmap'
alternatives.recommended = ['slotmap`, 'std::vec::Vec']
alternatives.other = ['yet_another_linked_list']

crates.io would use this recommendation data in both directions. There would be a new section on the results page for a particular crate:

Alternatives to this crate:

Recommended by the authors of this crate:
  • slotmap
  • std, std::vec::Vec
Recommended by their own authors:
  • super_slot_map
Other
  • yet_another_linked_list

Discussion and alternatives

I haven't deeply considered the exact metadata format and feature set. Sort order and precise presentation are TBD (and we could easily experiment with those). But I have some opinions about the shape of the metadata and what is done with it:

Required features for this to be useful and useable

  • A way for a crate author to get themselves listed in the alternatives section of another crate. This is what makes this an attractive thing to do even for a selfish crate author.
  • A way for a crate author to distinguish things they actually recommend from things they have listed only to get the back link.

Possibly useful features

  • A way for a crate author to produce only forward links. This would be a way to deprecate this crate and suggest what to use instead.
  • A way to provide links to related crates, which enhance this one.

These use cases can (and often are) currently handled by the README.md and crate-level rustdocs. For those, that would be sufficient for now at least.

  • Being able to point to a specific item. This is particularly useful if you want to point to the stdlib, or a part of a large suite like Tokio.

Definite non-features, ie things that should not be supported

  • A way for a crate author to say nasty things about another crate, especially on that other crate's page. For this reason I suggest no free text field
  • A way for a crate author to get a backward link from the other crate without also producing a forward link fromk their own crate.
@Turbo87
Copy link
Member

Turbo87 commented Jan 16, 2021

The very best crate authors discuss alternatives in their documentation but doing so is a lot of work, and the incentives to crate authors to do this are quite weak.

I'm not sure that would change by listing them in the Cargo.toml file instead, especially because there it can't be explained why the own crate is better than the alternatives

@ijackson
Copy link
Author

ijackson commented Jan 16, 2021 via email

@Turbo87
Copy link
Member

Turbo87 commented Feb 5, 2021

Hi @ijackson! We just discussed this issue in our weekly team meeting and concluded that we would prefer it if people would solve this via PRs to other project READMEs. If we enabled people to add content to crates that they don't own that would open the door to potential abuse and we would like to avoid that.

tl;dr we decided we won't move forward with this feature request.

@Turbo87 Turbo87 closed this as completed Feb 5, 2021
@Turbo87 Turbo87 added C-enhancement ✨ Category: Adding new behavior or a change to the way an existing feature works and removed C-feature-request labels Feb 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement ✨ Category: Adding new behavior or a change to the way an existing feature works
Projects
None yet
Development

No branches or pull requests

2 participants