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

Write about how coherence makes it nearly impossible to establish standard traits outside of libstd. #180

Open
4 tasks
nikomatsakis opened this issue Apr 29, 2021 · 4 comments
Labels
good first issue Good for newcomers help wanted Extra attention is needed status-quo-story-ideas "Status quo" user story ideas

Comments

@nikomatsakis
Copy link
Contributor

Brief summary

Write about how coherence makes it nearly impossible to establish standard traits outside of libstd.

In a nutshell:

  • If I define a trait that (say) all runtimes should implement, they obviously won't implement it yet; typically I then have to implement it for them, because they don't want to implement some Random Joe's trait;
  • at that point, my trait crate depends on all the runtime crates (albeit with optional features, presumably);
  • now those runtimes can't depend on my trait, so they can't implement it, even if they wanted to!

It's sort of a chicken-and-egg problem that seems like it would be quite hard to get around.

Optional details

  • (Optional) Which character(s) would be the best fit and why?
    • Alan: the experienced "GC'd language" developer, new to Rust
    • Grace: the systems programming expert, new to Rust
    • Niklaus: new programmer from an unconventional background
    • Barbara: the experienced Rust developer
  • (Optional) Which project(s) would be the best fit and why?
    • List some projects here.
  • (Optional) What are the key points or morals to emphasize?
    • Write some morals here.
@nikomatsakis nikomatsakis added good first issue Good for newcomers help wanted Extra attention is needed status-quo-story-ideas "Status quo" user story ideas labels Apr 29, 2021
@jonhoo
Copy link
Contributor

jonhoo commented Apr 29, 2021

Anecdotally, I think this extends beyond just async: imagine trying to introduce a replacement for serde today.

@rylev
Copy link
Member

rylev commented Apr 30, 2021

We will touch a little bit on this in #45. I wonder if the exploration in that story is good enough or if a separate story is needed to really drive home the point.

@zeenix
Copy link
Contributor

zeenix commented Apr 30, 2021

Anecdotally, I think this extends beyond just async: imagine trying to introduce a replacement for serde today.

I had the misfortune of running into something similar with zvariant, where for ser/de to/from the D-Bus format, I need a signature string for the type and hence had to require a trait to be implemented for types that can be ser/de. I provide a derive macro so local types are not a big issue but external types are.

@nikomatsakis
Copy link
Contributor Author

@jonhoo I definitely agree it extends beyond async

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed status-quo-story-ideas "Status quo" user story ideas
Projects
None yet
Development

No branches or pull requests

4 participants