3

Rust is very actively developed and the language itself is extended regularly through the RFC process. Some of these changes, such as the Generic Associated Types RFC, have a strong impact on API-design, because new, better APIs suddenly become possible, where they weren't before.

As example, consider the mentioned GATs RFC: with this feature, we could have collection traits and could write a better version of some traits, e.g. Deref. Or take the impl Trait RFC: with that, it would be desirable to change the Iterator trait such that methods like map() would return impl Iterator instead of Map.

This is a conflict: we could improve std, but not in a backwards-compatible manner. I heard something about "Rust Epochs" (discussed here) and I think they would allow for backwards-incompatible changes.

My question is: Are there already plans on how to change the standard library's API in order to use new language features? Is a new design considered for the Rust 2019 Epoch?

closed as off-topic by JJJ, Paolo Falabella, oli_obk, Joe Clay, Wesley Wiser Sep 7 '17 at 15:05

  • This question does not appear to be about programming within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • Regarding returning impl Iterator... is storing impl Iterator in a structure possible? If it is not, it would not be an improvement. – Matthieu M. Sep 7 '17 at 7:29
  • 6
    I'm voting to close this question as off-topic because it's about language and API design. I think it would be better suited to the Rust internals forum. I'd like to see an answer too, by the way... :) – Paolo Falabella Sep 7 '17 at 7:46
  • 1
    @PaoloFalabella I just asked in the internals forum. However, I disagree with the close votes. While in the internals forum my question is more of a discussion-nature, my question here on SO just asks about the current state of things; about facts. I didn't want to discuss here. I just wanted an answer like "yeah there are already ideas how to break std, see here" or "no, no one thought about it yet". Maybe the result of the internals discussion can serve as a basis for an answer here on SO. – Lukas Kalbertodt Sep 7 '17 at 14:13
  • New traits can be added to existing types without breaking backwards compatibility so I don't see why std would need to be changed to have collection traits. Additionally, I'm not seeing why returning impl Iterator is an improvement over Map. Sure, it seems conceptually cleaner, but I don't see a practical benefit. As others have mentioned, this seems like a better fit for the internals form than SO. – Wesley Wiser Sep 7 '17 at 15:05
  • @LukasKalbertodt having read through stackoverflow's help, some threads on meta and "Good subjective, Bad Subjective" I'm not so sure any more that your question is off topic. I still fear it might be devolve into opinion-based discussion, but what if a plan does exist or someone can point out to one of the RFCs for a relevant discussion on this? In doubt, I apologize with you and vote to reopen. – Paolo Falabella Sep 8 '17 at 13:05

Browse other questions tagged or ask your own question.