Topic: Why iterator?


Author: "Garfield Ahn" <stdcpp@naver.com>
Date: Tue, 23 Apr 2002 08:26:42 GMT
Raw View
It's maybe silly question but I wonder who first use the term "iterator"?
In my opinion "iterator" is not so good for understanding its concept.
(What about "navigator"?)

Do you know the history of the C++ Standard related the term "iterator"
and uncertainly agree it?





---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]





Author: "James Kuyper Jr." <kuyper@wizard.net>
Date: Tue, 23 Apr 2002 17:06:35 GMT
Raw View
Garfield Ahn wrote:
>
> It's maybe silly question but I wonder who first use the term "iterator"?
> In my opinion "iterator" is not so good for understanding its concept.
> (What about "navigator"?)
>
> Do you know the history of the C++ Standard related the term "iterator"
> and uncertainly agree it?

Iterators are part of the STL library, which was incorporated into C++
itself as part of the standardization process; before the 1998 standard,
the STL had been an independent library. According to Stroustrup, in
"D&E", it was developed by Alex Stepanov; he cites an HP labs Technical
Report authored by Stepanov and Meng Lee, dated August 1994. So
presumably you have one of them to blame for the name that was chosen.

I don't agree that "navigator" is any better than "iterator" as a name
for this concept. The key thing that an iterator can do is i++, which
can be described as iterating through the elements of a container.
"navigation" implies having a higher level view: it means knowing where
you are, and where your destination is, and deciding the best route to
get from where you are to where you're going. Iterators don't provide
that capability. Of themselves, they don't tell where the element they
point at is, relative to any other iterator.

Random-access iterators might be called navigators, because i-j does
give you that kind of information. However, most of the iterator
categories doen't support i-j; Input iterators support distance(i,j), or
distance(j,i), depending upon which order i and j are in, but the
behavior when they're not in the proper order is undefined, and there is
no way to determine that order by examining the iterators themselves. In
any event, if i and j are not random-access iterators, distance(i,j) is
very slow.

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]





Author: James Kanze <kanze@alex.gabi-soft.de>
Date: Wed, 24 Apr 2002 16:08:20 GMT
Raw View
"James Kuyper Jr." <kuyper@wizard.net> writes:

|>  Garfield Ahn wrote:

|>  > It's maybe silly question but I wonder who first use the term
|>  > "iterator"?  In my opinion "iterator" is not so good for
|>  > understanding its concept.  (What about "navigator"?)

|>  > Do you know the history of the C++ Standard related the term
|>  > "iterator" and uncertainly agree it?

|>  Iterators are part of the STL library, which was incorporated into
|>  C++ itself as part of the standardization process; before the 1998
|>  standard, the STL had been an independent library. According to
|>  Stroustrup, in "D&E", it was developed by Alex Stepanov; he cites
|>  an HP labs Technical Report authored by Stepanov and Meng Lee,
|>  dated August 1994. So presumably you have one of them to blame for
|>  the name that was chosen.

The name is largely anterior to the STL.  I remember hearing it as
early as 1990, always with more or less the STL meaning (iterators
into a container).  I suspect that it was old even when I first heard
it, and I wouldn't be surprised to learn that the very first Smalltalk
collections had iterators.

I used the term cursor in my library, but mainly because even back
then, everyone knew that an iterator operated alone, whereas my
cursors needed the container for dereference.  (Index might have been
an even better name, since I overloaded the operator[] on the
container to take a cursor.  But in my mind, index suggested random
access, which my iterators didn't support.)

--=20
James Kanze                                mailto:kanze@gabi-soft.de
Conseils en informatique orient=E9e objet/
                    Beratung in objektorientierter Datenverarbeitung
Ziegelh=FCttenweg 17a, 60598 Frankfurt, Germany Tel. +49(0)179 2607481

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]





Author: "Al Grant" <tnarga@arm.REVERSE-NAME.com>
Date: Thu, 25 Apr 2002 12:12:57 GMT
Raw View
"James Kanze" <kanze@alex.gabi-soft.de> wrote in message
news:868z7drvte.fsf@alex.gabi-soft.de...
"James Kuyper Jr." <kuyper@wizard.net> writes:
>The name is largely anterior to the STL.  I remember hearing it as
>early as 1990, always with more or less the STL meaning (iterators
>into a container).  I suspect that it was old even when I first heard
>it, and I wouldn't be surprised to learn that the very first Smalltalk
>collections had iterators.

I think it was the CLU language in the mid-70s that introduced
the term "iterator" for this concept.  It had template classes,
though it called them parameterized clusters.


---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]