ideas about ranges

Steven Schveighoffer schveiguy at yahoo.com
Tue May 26 11:11:54 PDT 2009


On Tue, 26 May 2009 13:45:05 -0400, Steve Teale  
<steve.teale at britseyeview.com> wrote:

> Steve,
>
> I'm glad to see that there are others out there who are equally  
> skeptical about ranges..
>
> Your point about Ranges being similar to an early view of OOP is a good  
> one. Just because someone comes up with an interesting concept, it does  
> not mean you need to use it all the time, or even ever if it does not  
> sit well with you.

Ranges to me are a great concept.  They are safer than C++ iterators, but  
they are not exactly new.  For example Java Iterators are essentially  
input ranges.

However, STL algorithms applied to such concepts has not often been done  
(if ever before), probably because not many languages have such extensive  
template support.  It's certainly an interesting pairing, and I think it  
will prove to be a great fit.

On the skeptical side, I don't think ranges are a great fit for all cases  
where C++ iterators work well.  Using iterators as a marker, for instance,  
is not handled well by a range.  It seems to me that streams also don't  
fit well as a range (but certainly there needs to be some connector code  
between ranges and streams).

So I guess, you wouldn't call me a skeptic, but I'm certainly not  
convinced that ranges are the solution to all problems :)

-Steve



More information about the Digitalmars-d mailing list