Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

sfackler
Copy link
Member

@sfackler sfackler commented Jun 1, 2014

No description provided.

@alexcrichton
Copy link
Member

I find it kinda nice that it would bring the PartialOrd trait in line with the Ord trait in terms of what it provides (under the proposed system). I may lean towards PartialLess instead of PartialOrdLess in terms of naming.

The default implementations could always be overridden if performance is necessary, so I wouldn't see the concern of the default implementation providing a possibly slow default being too worrisome.

@sfackler
Copy link
Member Author

sfackler commented Jun 2, 2014

I'm using PartialOrdLess because if the thing at the bottom happens as well, both PartialOrdering and PartialEquality would have a variant named PartialEqual otherwise. If we're not going to add partial_eq then we can drop the Ord from the variants.

@glaebhoerl
Copy link
Contributor

Why not just Option<Ordering>?

@huonw
Copy link
Contributor

huonw commented Jun 2, 2014

@glaebhoerl that is currently 2 bytes. (But implementing an optimisation like rust-lang/rust#14540 would fix that small issue.)

@sfackler
Copy link
Member Author

sfackler commented Jun 2, 2014

@glaebhoerl oh, that's a good idea. I'm not super concerned about a 1 byte difference in representation size. I can't imagine people storing millions of partial ordering results or anything.

I'd prefer to keep an enum around for partial_eq as Option<bool> doesn't seem to carry the same meaning as the PartialEquality enum in my eyes.

@glaebhoerl
Copy link
Contributor

I'd prefer to keep an enum around for partial_eq as Option<bool> doesn't seem to carry the same meaning as the PartialEquality enum in my eyes.

I have the same feeling. Something like enum IsItEqual { DefinitelyEqual, DefinitelyInequal } and then you can put that in an Option for great symmetry.

@sfackler
Copy link
Member Author

sfackler commented Jun 3, 2014

Updated in line with @glaebhoerl's comments.

@sfackler
Copy link
Member Author

sfackler commented Jun 4, 2014

Here's an example of use of partial_cmp to help with some nontrivial PartialOrd impls: rust-postgres/rust-postgres@21feed4

@alexcrichton
Copy link
Member

We decided to accept this RFC, discussed in today's meeting

@Centril Centril added the A-compare Proposals relating to comparisons. label Nov 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-compare Proposals relating to comparisons.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.