-
Notifications
You must be signed in to change notification settings - Fork 341
Description
Summary
Why the iterator combinators in this crate (and elsewhere) return concrete public types like Interleave<I, J> instead of opaque impl Traits?
Musing
I've been using itertools for a long time without thinking twice about the actual types returned by the different combinators etc. They're basically never seen, only existing between the lines. Seems like they might as well be opaque types and I wouldn't even notice. impl Iterator<...> or something.
It's not like I have anything against the current design. I would just like to understand the reasons behind it.
Guesses
Some ideas of what might be part of the of the reasoning:
- Backward compatibility: Maybe this was the only stable way at some time in the past?
- Type inference: Perhaps the opaque types cause undue burden on the compiler?
PS's
PS. I got here hoping to find the answer in CONTRIBUTING.md, so perhaps we could close this issue by adding a paragraph :)
PPS. This has to be one of the best crates in the rust ecosystem. Thanks to everyone who contributed!