Two small points of feedback

Vitaly Davidovich vitalyd at gmail.com
Fri Jan 4 08:44:30 PST 2013


FWIW, .NET, Enumerable.Range() takes the starting number and then the count
of consecutive numbers to generate.  So Range(1,10) produces the 1...10
inclusive, which I think is more natural for a method like this.

Sent from my phone
On Jan 4, 2013 10:54 AM, "Michael Nascimento" <misterm at gmail.com> wrote:

> I'd prefer rangeInclusive() / rangeExclusive() . The more explicit in
> this case, the better.
>
> Regards,
> Michael
>
> On Fri, Jan 4, 2013 at 1:49 PM, Stephen Colebourne <scolebourne at joda.org>
> wrote:
> > On 4 January 2013 15:05, Brian Goetz <brian.goetz at oracle.com> wrote:
> >>> My theory is that its because the numbers are discrete. "From Monday
> >>> to Wednesday" is closed in normal language, whereas "from 09:00 to
> >>> 17:00" is not. Similarly "the TV channels 1 to 4" is closed, but "from
> >>> 1.3 to 8.6" is more likely to be half-open.
> >>
> >> And what about
> >>
> >>   string.substring(0, 10)
> >> or
> >>   Arrays.sort(a, 0, 10)
> >>
> >> or...?   These have discrete numbers too.
> >
> > These are indices into a list/array/string. Range defines the set of
> > ints themselves. These is related but not entirely the same. (indices
> > point at the gaps between things, a range of ints points at the things
> > themselves). So, yes, I think there is a conceptual difference.
> >
> > I believe you need two methods. One of these three options:
> > - rangeInclusive()
> > - rangeExclusive()
> >
> > - range()
> > - rangeExclusive()
> >
> > - range()
> > - rangeInclusive()
> >
> > I don't currently have a strong preference between them.
> >
> > I don't support a boolean flag on range() as that is meaningless. An
> > enum would be too verbose IMO.
> > Stephen
> >
>
>


More information about the lambda-dev mailing list