Suggest PartialEq impls are symmetric when possible #235
KodrAus
started this conversation in
API Guidelines
Replies: 1 comment
|
My personal opinion is that recommending symmetry seems ok, but it could also be possible to paper over non-symmetric impls more easily. You can locally reason about whether a symmetric impl for a concrete Transitivity doesn't seem like a reasonable requirement you can actually satisfy, since it's non local you'd be effectively picking some arbitrarily reachable types to add transitive equality impls for. Maybe a guideline for public APIs could be to consider useful |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
rust-lang/rust#81198 suggests removing the symmetry and transitivity contracts from
PartialEq's standard library documentation. It has some examples of how these requirements can be difficult or undesirable in practice.That doesn't mean there isn't necessarily an API Guideline to consider for
PartialEqon public items. Should we recommend corresponding symmetric and transitive impls ofPartialEqexist when it's possible to add them?All reactions