On 07/19/2010 03:37 PM, Peter Alexander wrote:
I've been following the D programming language for quite some time now,
and only recently decided to dive in and start using it. My first
impressions are that it is a very nice language (despite the library
bugs), but one thing in particular that confused me was the lack of
iterators, and their near complete replacement by ranges.
I did notice that there is an std.iterator library, which is said to be
"growing" in the documentation.
The existence of std.iterator is a mistake on my part.
What is the plan for this library? Will the std.algorithm start to use a
mixture of iterators and ranges (as it should, in my opinion)?
The plan is to use ranges everywhere. Sorry to disappoint. If you can
find solid arguments for introducing iterators, of course it would be
great if you discussed them in this group.
In his article, "On Iteration"
(http://www.informit.com/articles/article.aspx?p=1407357&seqNum=12)
Andrei admitted that ranges had weaknesses when compared to iterators,
so I would be very disappointed if iterators weren't to make it into the
standard library.
In the thread on improving std.algorithm.find, there were mentions of
making find (or some findFirst) that returned a single element. Would
this be an iterator, or a single value range?
The result of find() is (and is planned to be after the overhaul of
find) the balance of the searched range positioned on the found element.
I don't think a singleton range would hold an advantage over that.
Andrei