Ranges and/versus iterators
Lars T. Kyllingstad
public at kyllingen.NOSPAMnet
Tue Mar 23 05:11:28 PDT 2010
clueless bystander wrote:
> Lars T. Kyllingstad Wrote:
>
>> clueless bystander wrote:
>>> Watching D evolve from the outside there seems to be a lot of ongoing discussion
>>> on this newsgroup about the D range idiom which is somehow opposed to conventional
>>> thinking about iterators.
>>>
>>> Can someone please explain in plain words just exactly what a range is and how
>>> it differs from the iterator concept (if that's appropriate???) and what are the benefits
>>> from a data modeling and access perspective.
>>>
>>> Sure, I'm clueless, though suspect many other bystanders would appreciate a
>>> succinct heads-up.
>>>
>>> Thanks,
>>> clueless bystander
>>
>> I'm probably not the right person to answer your question, since I have
>> virtually no experience with C++ iterators. Instead I'll just refer you
>> to Andrei's own article on the subject:
>>
>> http://www.informit.com/articles/article.aspx?p=1407357
>>
>> Please don't hesitate to ask again if it didn't clear things up for you. :)
>>
>> -Lars
>
> Yes, well, thanks again. The first 7 pages seemed to have plausible arguments
> but the going get tough thereafter. Maybe the reason ranges are not popular
> is that they are hard to explain even though they might be simple and obvious
> in hindsight.
>
> Sigh,
> c.b.
The reason ranges are not popular is because they haven't had time to
become popular yet. The range concept itself is rather new, not much
older than the article I referred you to, and AFAIK it's only been
implemented in the D2 standard library.
I'm sure there are several people on this forum that can give you a
satisfactory (and succinct) answer. You may want to check back in a few
hours, when activity picks up.
FWIW, I don't think the concept of ranges is very hard to grasp. I just
haven't used them that much, that's why I don't want to be the one to
answer your question (and, like I said before, I have never used C++
iterators so I can't compare them either).
-Lars
More information about the Digitalmars-d
mailing list