rust-simplicity
rust-simplicity copied to clipboard
Remove Ord impl for Value
trafficstars
It makes no semantic sense to compare values of different types. Rather, PartialOrd could return None if self.ty != other.ty.
Yes -- I tried this, but we then lose Ord on Word (which maaybe makes sense, you can compare them numerically though you have to decide the relationship between 0u4 and 0u16 etc), and on Node and on Policy... so it's far-reaching.
I think the right approach would be to change Policy to implement Ord manually in alphabetical order (we do this in rust-miniscript now; it was a PITA to implement) and then we can drop Ord on the smaller types.
(see #266)
We have to see how much work it is, but making the API more semantically consistent seems worth some effort.