ints(), longs(), doubles() <was> Re: Ranges

Brian Goetz brian.goetz at oracle.com
Fri May 3 09:20:06 PDT 2013


There are two situations that give rise to ranges: math problems (which 
generally want closed ranges) and indexing (which generally wants open 
ranges.)  And its hard to satisfy both with one method.

One question is: should they be spelled the same way?  Would 
indexes(start, bound) and range(start, end) be better than having 
range(start, bound) and rangeClosed(start, end) ?

On 5/3/2013 12:06 PM, Tim Peierls wrote:
> On Fri, May 3, 2013 at 10:53 AM, Paul Sandoz <paul.sandoz at oracle.com
> <mailto:paul.sandoz at oracle.com>> wrote:
>
>     On May 3, 2013, at 3:00 PM, Tim Peierls <tim at peierls.net
>     <mailto:tim at peierls.net>> wrote:
>>     I've missed something. How will the user see a difference between
>>     ints() implemented as a closed range vs. a half-open range?
>     The closed range will be for all non-negative int values, where as
>     the half open will be for all non-negative int values except
>     Integer.MAX_VALUE.
>
> If you were originally asking whether ints() should include MAX_VALUE,
> then my answer is yes. *How* its implementation accomplishes this isn't
> that important to me, whether as rangeClosed(0, Integer.MAX_VALUE) or
> something else.
>
> --tim


More information about the lambda-libs-spec-experts mailing list