the pdf seems 404'd at the moment, but I got the gist from google's
translation:
http://74.125.47.132/search?q=cache:zos4-62ZtLoJ:www.boostcon.com/site-media/var/sphene/sphwiki/attachment/2009/05/08/iterators-must-go.pdf+iterators-must-go.pdf&cd=2&hl=en&ct=clnk&gl=us&client=firefox-a
It seems that Andrei noticed that c++'s iterators are awful compared to the
collections in the rest of the programming world.
He makes two claims, first that the space of iterators is all muddled up.
Other libraries make a distinction between iterable and iterator. C++
doesn't.. mostly.
Also, iterators have to be manually managed. Why on earth should you have to
write for_each(iter.begin, iter.end(), {do something}) when the iterator
itself knows exactly when it should stop.
So ranges are a combination of two iterators, in this case they act as
markers of the begin end... so you could just write
range.foreach( { do something })
They can also simply allow you to iterate backwards and describe more
complex interactions.
There is nothing new here in terms of programming languages that Andrei
offers, he just came up with a very simple way to describe them in terms of
existing STL structures. Quite simple really, and will represent a huge
improvement. IMO, but again, this just catches C++ up with the rest of the
programming world.
I would also like to note that Tango, the other standard library for D, had
this solved from its inception. It was Walter's insistence that D's STL look
like C++'s STL that caused the creators of Tango to branch off. Collections
were the most major points of departure.
On Mon, Mar 22, 2010 at 6:21 PM, Ian P. Cooke <[email protected]> wrote:
>
> a side-note re: iterators here...
>
> does anyone here have experience with D's Range construct?
>
> http://lambda-the-ultimate.org/node/3520
>
> http://www.digitalmars.com/d/archives/digitalmars/D/Iterators_Must_Go_89524.html
>
> They argue that Ranges make more sense than Iterators, esp. in the context
> of defining standard algorithms.
>
> Which makes more sense to take as primitive?
>
> -ipc
>
>
> _______________________________________________
> bitc-dev mailing list
> [email protected]
> http://www.coyotos.org/mailman/listinfo/bitc-dev
>
_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev