[m-rev.] for review: fix a bug in calendar.duration_between/2

Julien Fischer jfischer at opturion.com
Sun Jun 28 00:20:57 AEST 2026


On Sat, 27 Jun 2026 at 14:57, Zoltan Somogyi <zoltan.somogyi at runbox.com> wrote:

> > > +    % greedy_subtract_descending(OriginalOrder, DateA, DateB, Duration):
> > > +    %
>
> What is the utility of having one predicate do both original orders?

At this point, there is arguably no utility.

> It is harder to see in a diff, but I have the impression that the predicate body
> has significantly more code that differs between two cases than common code.
> If you had the two cases in different predicates, you could use variable names
> that would be MUCH more descriptive than Date[AB], and readers wouldn't have to
> juggle the two meanings of each variable name in their heads.
>
> Your logic seems ok to me, but, due to the issue above, I am not confident
> in saying that. If you post a version that I find more readable, I could review
> that later today.

The attached diff addresses the above points.

Julien.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DIFF.duration
Type: application/octet-stream
Size: 10604 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/reviews/attachments/20260628/a00141a1/attachment-0001.obj>


More information about the reviews mailing list