Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upTracking issue for `iter_order` stabilization #27737
Comments
aturon
added
T-libs
B-unstable
labels
Aug 12, 2015
This comment has been minimized.
This comment has been minimized.
|
One thing of note is that the origin of this API was to help libcollections, so that the collections didn't all have to reimplement correct PartialOrd eq, le, gt, etc handling*. With time, most of the collections maybe(?) will develop their own specialized versions and make it obsolete. As noted in #26884, these methods are inferior for equality checking since they cannot assume that the two iterators are of equal length. *Due to PartialOrd weirdness, every collection must implement all of lt, le, gt, ge. |
This comment has been minimized.
This comment has been minimized.
|
It seems like these should really be methods on pub trait Iterator {
....
fn eq<E, I>(self, other: I) -> bool where Self: Sized, Self::Item: Eq<E>, I: Iterator<Item = E> { ... }
// etc
} |
sfackler
added a commit
to sfackler/rust
that referenced
this issue
Aug 24, 2015
sfackler
referenced this issue
Aug 24, 2015
Merged
Make iter::order functions into methods on Iterator #27975
sfackler
added a commit
to sfackler/rust
that referenced
this issue
Aug 27, 2015
bors
added a commit
that referenced
this issue
Aug 27, 2015
This comment has been minimized.
This comment has been minimized.
|
Would like to stabilize these in the next cycle. |
sfackler
added
the
I-nominated
label
Sep 17, 2015
This comment has been minimized.
This comment has been minimized.
By the way, is this the same as fn eq<I>(self, other: I) -> bool where Self: Sized, Self::Item: Eq<I::Item>, I: Iterator { ... }? |
This comment has been minimized.
This comment has been minimized.
|
Your version's basically how it was actually defined when implemented: https://doc.rust-lang.org/nightly/std/iter/trait.Iterator.html#method.cmp. |
This comment has been minimized.
This comment has been minimized.
|
This issue is now entering its cycle-long FCP for stabilization in 1.5 |
alexcrichton
added
final-comment-period
and removed
I-nominated
labels
Sep 24, 2015
steveklabnik
added this to the 1.5 milestone
Oct 1, 2015
This comment has been minimized.
This comment has been minimized.
|
Can’t these be implementations of PartialEq/PartialOrd for relevant iterators instead? |
This comment has been minimized.
This comment has been minimized.
|
These traits take |
This comment has been minimized.
This comment has been minimized.
|
The libs team discussed this during triage today and the decision was to stabilize. |
aturon commentedAug 12, 2015
The
itermodule has anordersubmodule for performing comparisons on iterators. Ideally, these would instead just be implementations of e.g. thePartialOrdtrait, but that trait passes by shared reference, and iterators must be mutated to be compared.It'd be good to explore this design space, and perhaps write an RFC, before stabilization.
cc @bluss