I'm doing a experimental migration of my project from chrono to jiff, and I've run into subtle errors involving Span comparisons. This usually involves subtracting two DateTimes and checking that its TimeDelta/Span is some value.
The documentation says:
A Span implements the PartialEq and Eq traits, but not the PartialOrd or Ord traits. In particular, its Eq trait implementation compares for field-wise equality only. This means two spans can represent identical durations while comparing inequal
Perhaps Span should not implement PartialEq and Eq at all. I would rather the compiler give an error if I'm doing the wrong thing rather than have a subtle bug go through. This behavior breaks the principle of least surprise. If a person unfamiliar with jiff sees &dt1 - &dt2 == some_span in code review, they probably would not think that it's a serious bug.
I'm doing a experimental migration of my project from chrono to jiff, and I've run into subtle errors involving Span comparisons. This usually involves subtracting two DateTimes and checking that its TimeDelta/Span is some value.
The documentation says:
A Span implements the PartialEq and Eq traits, but not the PartialOrd or Ord traits. In particular, its Eq trait implementation compares for field-wise equality only. This means two spans can represent identical durations while comparing inequalPerhaps Span should not implement PartialEq and Eq at all. I would rather the compiler give an error if I'm doing the wrong thing rather than have a subtle bug go through. This behavior breaks the principle of least surprise. If a person unfamiliar with jiff sees
&dt1 - &dt2 == some_spanin code review, they probably would not think that it's a serious bug.