use correct naming for the comparison traits and add trait inheritance #12517
Closed
Description
Updated description
The target end point: https://gist.github.com/alexcrichton/10945968
Original issue
- rename
Ord
->PartialOrd
- rename
TotalOrd
->Ord
- rename
Eq
->PartialEq
- rename
TotalEq
->Eq
-
PartialOrd
inherits fromPartialEq
-
Ord
inherits fromEq
-
Ord
inherits fromPartialOrd
-
Eq
inherits fromPartialEq
- remove
equals
method (TotalEq
deriving needs to be redone) - deriving
Ord
also derivesPartialOrd
- deriving
Eq
also derivesPartialEq
An implementation of Eq
will simply mean that the PartialEq
implementation provides equivalence rather than partial equivalence. An Ord
implementation will add a single cmp
method and the guarantee of the PartialOrd
implementation providing a total order.
This allows code generic over Float
to use the operators, since it will inherit from PartialEq
and PartialOrd
. Code generic over Eq
and Ord
will also be able to use the operators, despite not being designed to handle a partial order.