Range Type
renoX
renosky at free.fr
Mon Mar 24 09:44:19 PDT 2008
Janice Caron a écrit :
> 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). :-)
Well, most range will probably be integer range, so if we could define
Range! to be Range!(int) by default then it would be even less typing
than int..int.
Shouldn't we plan an optional 'step' parameter now?
That said, the 'step' is always messy to add, so having just Range with
lower and upper would be a good start.
renoX
PS:
I have the impression that each language grows to reimplement Ada at
some point ;-)
(which for me is a good thing!).
More information about the Digitalmars-d
mailing list