skip to main content
article
Open Access

Iteration abstraction in Sather

Published:01 January 1996Publication History
Skip Abstract Section

Abstract

Sather extends the notion of an iterator in a powerful new way. We argue that iteration abstractions belong in class interfaces on an equal footing with routines. Sather iterators were derived from CLU iterators but are much more flexible and better suited for object-oriented programming. We retain the property that iterators are structured, i.e., strictly bound to a controlling structured statement. We motivate and describe the construct along with several simple examples. We compare it with iteration based on CLU iterators, cursors, riders, streams, series, generators, coroutines, blocks, closures, and lambda expressions. Finally, we describe experiences with iterators in the Sather compiler and libraries.

References

  1. ABELSON, H., SUSSMAN, G. J., AND SUSSMAN, J. 1985. Structure and Interpretation of Computer Programs. MIT Press, Cambridge, Mass. Google ScholarGoogle Scholar
  2. ELLIS, iV{. A. AND STROUSTRUP, B. 1990. The Annotated C-l--l- Reference Manual. Addison-Wesley, Reading, Mass. Google ScholarGoogle Scholar
  3. GOLDBERG, A. AND ROBSON, D. 1985. Smalltalk-80, The Language and its Implementation. Addison-Wesley, Reading, Mass. Google ScholarGoogle Scholar
  4. Goos, G. 1994. Sather-K. Tech. Rep. 8/94, Faculty of Computer Science, University of Karlsruhe, Karlsruhe, Germany.Google ScholarGoogle Scholar
  5. HEWITT, C. 1977. Viewing control structures as patterns of passing messages. Artif. Intell. 8, 323-364.Google ScholarGoogle Scholar
  6. HOARE, C. A. R. 1985. Communicating Sequential Processes. Prentice-Hall, Englewood Cliffs, N.J. Google ScholarGoogle Scholar
  7. LISKOV, B. AND GUTTAG, J. 1986. Abstraction and Specification in Program Development. MIT Press, Cambridge, Mass. Google ScholarGoogle Scholar
  8. MARLIN, C. D. 1980. Coroutines: A Programming Methodology, a Language Design, and an Implementation. Springer-Verlag, Berlin, Germany. Google ScholarGoogle Scholar
  9. MCDERMOTT, D. V. AND SUSSMAN, G. J. 1974. The Conniver reference manual. Tech. Rep. Artificial Intelligence Memo 259a, MIT, Cambridge, Mass.Google ScholarGoogle Scholar
  10. MEYER, B. 1988. Object-Oriented Software Construction. Prentice-Hall, Englewood Cliffs, N.J. Google ScholarGoogle Scholar
  11. iV{URER, S., FELDMAN, J. A., ElM, C.-C., AND SEIDEL, M.-M. 1993. pSather: Layered extensions to an object-oriented language for efficient parallel computation. Tech. Rep. TR-93-028, International Computer Science Institute, Berkeley, Calif.Google ScholarGoogle Scholar
  12. NEWELL, t. AND TONGE, F. iV{. 1960. An introduction to Information Processing Language V. Tech. Rep. Paper P-1929, The RAND Corp., Los Angeles, Calif. Presented at the ACM National Conference, Boston, 1959.Google ScholarGoogle Scholar
  13. OMOHUNDRO, S. AND LIM, C.-C. 1992. The Sather language and libraries. Tech. Rep. TR-92-017, International Computer Science Institute, Berkeley, Calif.Google ScholarGoogle Scholar
  14. STEELE, JR., G. L. 1990. Common LISP, The Language, 2nd ed. Digital Press, Bedford, Mass. Google ScholarGoogle Scholar
  15. STOUTAMIRE, D. AND OMOHUNDRO, S. 1995. Sather 1.1. Tech. rep., International Computer Science Institute, Berkeley, Calif. Available at http://www.icsi, berkeley.edu/Sather.Google ScholarGoogle Scholar
  16. SUSSMAN, G. J. AND STEELE, JR., G. L. 1975. Scheme: An interpreter for extended lambda calculus. Tech. Rep. Artificial Intelligence Memo 349, MIT, Cambridge, Mass. Google ScholarGoogle Scholar
  17. SZYPERSKI, C. A. 1992. Insight ETHOS: On Object-Orientation in Operating Systems. Informatik- Dissertationen ETH Ziirich. Vol. 40. Verlag der Fachvereine, Zurich, Switzerland.Google ScholarGoogle Scholar
  18. WIRTH, N. 1983. Programming in Modula-2. Springer, Berlin, Germany. Google ScholarGoogle Scholar
  19. WIRTH~ N. AND GUTKNECHT~ J. 1992. Project Oberon--The Design of an Operating System and Compiler. Addison-Wesley, Reading, Mass. Google ScholarGoogle Scholar

Index Terms

  1. Iteration abstraction in Sather

          Recommendations

          Reviews

          Arthur Gittleman

          Sather is an object-oriented language derived from Eiffel. Sather iterators, described here, derive from CLU but remove some limitations of CLU iterators, such as there being one iterator per loop; there being no way to modify elements; and iterator arguments being loop invariant. In Sather, multiple iterators may be invoked within a single loop, and there are hot arguments that are reevaluated each time control is passed back to the iterator. Several examples in section 2 show the power and ease of use of Sather iterators. Section 3 gives the details of the iterator construct. In section 4, the authors compare Sather iterators with other approaches. They find that: cursors are harder to use; built-in loop constructs are not general enough; passing of closures does not effectively support the simultaneous traversal of multiple data structures; and streams come closest to Sather iterators, but are not bound to a specific loop. Analyzing a Sather compiler written in Sather showed many uses of nontrivial Sather iterators, making the code simpler and easier to read. The authors conclude that iterators eliminate common errors by combining initialization, progression, and termination into one abstraction that does not need to be managed by client code. In this well-written paper, the authors make an excellent case for Sather iterators.

          Access critical reviews of Computing literature here

          Become a reviewer for Computing Reviews.

          Comments

          Login options

          Check if you have access through your login credentials or your institution to get full access on this article.

          Sign in

          Full Access

          • Published in

            cover image ACM Transactions on Programming Languages and Systems
            ACM Transactions on Programming Languages and Systems  Volume 18, Issue 1
            Jan. 1996
            108 pages
            ISSN:0164-0925
            EISSN:1558-4593
            DOI:10.1145/225540
            Issue’s Table of Contents

            Copyright © 1996 ACM

            Publisher

            Association for Computing Machinery

            New York, NY, United States

            Publication History

            • Published: 1 January 1996
            Published in toplas Volume 18, Issue 1

            Permissions

            Request permissions about this article.

            Request Permissions

            Check for updates

            Qualifiers

            • article

          PDF Format

          View or Download as a PDF file.

          PDF

          eReader

          View online with eReader.

          eReader