Home > lambdatheultimate > On Iteration

On Iteration

May 12th, 2010 05:52 admin Leave a comment Go to comments

On Iteration, by Andrei Alexandrescu.

Lisp pioneered forward iteration using singly-linked lists. Later object-oriented container designs often used the Iterator design pattern to offer sequential access using iterators. Though iterators are safe and sensible, their interface prevents definition of flexible, general, and efficient container-independent algorithms. For example, you can’t reasonably expect to sort, organize as a binary heap, or even reverse a container by just using its Iterator. At about the same time, C++’s Standard Template Library (STL) defines its own conceptual hierarchy of iterators and shows that container-independent algorithms are possible using that hierarchy. However, STL iterators are marred by lack of safety, difficulty of usage, difficulty of definition, and a very close relationship to C++ that limits adoption by other languages. I propose an API that combines the advantages of Iterator and STL, and I bring evidence that the proposed abstraction is sensible by implementing a superset of STL’s algorithms in the D language’s standard library.

Previously: Iterators Must Go.

Source: On Iteration

Related Articles:

  1. Technical Objections To the Ogg Container Format
  2. Racket Released
  3. Oxford Expands Library With 153 Miles of Shelves
  4. SEC Proposes Wall Street Transparency Via Python
  5. OSCON 2010 Emerging Languages Camp
blog comments powered by Disqus