groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Veit <>
Subject Re: Java 8 Date/Time API Extensions Methods [GROOVY-8334]
Date Sun, 18 Mar 2018 16:45:46 GMT

> 2) changing the behavior of the upto method (and downto) so that, when
> using a custom unit of iteration that prevents the start value from being
> incremented exactly to the end value, the method returns as soon as the
> current value becomes strictly later than the end value. In my first stab
> at it, the method returned when the current iteration value became later
> than the end value _by at least one unit_. As a result, the closure could
> be called with a value later than the end parameter, which seemed
> undesirable. e.g.

Judging from my experience in dealing with time intervals, the most
natural way for defining them is as half-open intervals with the lower
bound included and the upper bound excluded. This allows the whole
timeline to be completely and non-overlapping covered with such
intervals. This is not only a mathematically desireable property, but
also helps making code simpler in many cases.

I do not know, if this approach is in accordance with the general design
rules of this API, but if so, it would suggest that an ascending
iteration should not yield values greater or equal the upper bound.

Just my 2 cents,

View raw message