Shout out to D at cppcon, when talkign about ranges.

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Thu Oct 1 01:37:39 PDT 2015


On 9/30/2015 10:47 PM, Eric Niebler wrote:
> P.S. I see lots of people here assuming that C++ is playing catch-up to D
> because D has ranges and C++ doesn't yet. That is ignoring the long history of
> ranges in C++. C++ got ranges in the form of the Boost.Range library by Thorsten
> Ottoson sometime in the early 00's. Andrei didn't implement D's ranges until
> many years after. The ranges idea is older than dirt. It's not a D invention.

Range iteration over arrays have been around in D since the beginning
and a more general proposal first appears here:

http://www.digitalmars.com/d/archives//12773.html

and Matthew Wilson did his range library for D in 9/2004 (and one for C++, too). 
He said he was going to propose it for Boost, I don't know if he ever did. It 
does appear in his "Imperfect C++" book. Matthew, a bit to my frustration, would 
always implement the D ideas first for C++ :-) but I don't think they garnered 
any attention from the C++ community.

news://news.digitalmars.com/rangelib

Here's something I wrote to Matthew in Feb 2004:

"I think ranges in D are the same thing as slices. C++ doesn't have slices,
so ranges makes sense as a distinct object. In D, slices over a collection
or array simply yield a subset collection or subset array, not a separate
object, so I'm not sure what value they would add to D."

I found a link to Thorsten's Boost range:

http://www.boost.org/doc/libs/1_34_0/libs/range/doc/intro.html
http://www.boost.org/doc/libs/1_34_0/libs/range/doc/range.html

It returns an iterator, so I don't think it is what we'd consider a range to be 
today.

Matthew's ranges had the following members:

     current
     advance
     is_open

corresponding to front, popFront, and empty.

So I'd say given what I can dig up, that D's ranges were more advanced than 
Boost's were at the time.

Sadly, Matthew's work seems to have disappeared from the internets and his web 
sites have vanished (rangelib.org).

Update: found it on web.archive.org!

https://web.archive.org/web/20050427085507/http://rangelib.synesis.com.au/

Anyhow, this is what I could dig up in an hour or so.


More information about the Digitalmars-d mailing list