Range Type

Craig Black cblack at ara.com
Mon Mar 24 08:30:48 PDT 2008


"Janice Caron" <caron800 at googlemail.com> wrote in message 
news:mailman.197.1206370014.2351.digitalmars-d at puremagic.com...
> On 24/03/2008, Craig Black <cblack at ara.com> wrote:
>> Why would the type T and U ever be different?  What's the point of the
>>  second type being different than the first?
>
> Um ... I have no idea. I guess it's just to be consistent with the
> fact that we can already declare:
>
>    opSlice(T lower, U upper)
>
> with T and U being different. Maybe someone will find a use for it one
> day. That said, it does at least allow you to use ".." in
> declarations, as in:
>
>    int..int x;
>    x = 3..4;
>
> and you have to admit, T..T is likely to be less typing (and look
> prettier) than Range!(T). :-)

Why not just leave out the second type and save some typing?

int.. x;
x = 3 .. 4;






More information about the Digitalmars-d mailing list