ABSTRACT
This paper introduces interruptible iterators, a language feature that makes expressive iteration abstractions much easier to implement. Iteration abstractions are valuable for software design, as shown by their frequent use in well-designed data structure libraries such as the Java Collections Framework. While Java iterators support iteration abstraction well from the standpoint of client code, they are awkward to implement correctly and efficiently, especially if the iterator needs to support imperative update of the underlying collection, such as removing the current element. Some languages, such as CLU and C# 2.0, support iteration through a limited coroutine mechanism, but these mechanisms do not support imperative updates. Interruptible iterators are more powerful coroutines in which the loop body is able to interrupt the iterator with requests to perform updates. Interrupts are similar to exceptions, but propagate differently and have resumption semantics. Interruptible iterators have been implemented as part of the JMatch programming language, an extended version of Java. A JMatch reimplementation of the Java Collections Framework shows that implementations can be made substantially shorter and simpler; performance results show that this language mechanism can also be implemented efficiently.
- Chad Fowler Dave Thomas and Andy Hunt. Programming Ruby: The Pragmatic Programmers' Guide. The Pragmatic Programmers, 2nd edition, 2004. ISBN 0-974-51405-5.Google Scholar
- Ralph E. Griswold, David R. Hanson, and John T. Korb. Generators in ICON. ACM Transaction on Programming Languages and Systems, 3(2), April 1981. Google ScholarDigital Library
- James Gosling, Bill Joy, Guy Steele, and Gilad Bracha. The Java Language Specification. Addison Wesley, 2nd edition, 2000. ISBN 0-201-31008-2. Google ScholarDigital Library
- John B. Goodenough. Exception handling design issues. SIGPLAN Notices, 10(7):41--45, 1975. Google ScholarDigital Library
- Emden R. Gansner and John H. Reppy. The Standard ML Basis Library. Cambridge University Press, October 2004. Google ScholarDigital Library
- Steven Gregory. Parallel Programming in PARLOG. Addison-Wesley, 1987.Google Scholar
- C. T. Haynes, D. P. Friedman, and M. Wand. Obtaining coroutines from continuations. Journal of Computer Languages, 11(3--4):143--153, 1986. Google ScholarDigital Library
- Anders Hejlsberg, Scott Wiltamuth, and Peter Golde. The C# Programming Language. Addison-Wesley, 1st edition, October 2003. ISBN 0321154916.Google Scholar
- Richard Kelsey, William Clinger, and Jonathan Rees (editors). Revised 5 report on the algorithmic language Scheme. ACM SIGPLAN Notices, 33(9):26--76, October 1998. Google ScholarDigital Library
- B. Kirkerud. Object-Oriented Programming with SIMULA. Addison-Wesley, 1989. Google ScholarDigital Library
- B. Liskov et al. CLU reference manual. In Goos and Hartmanis, editors, Lecture Notes in Computer Science, volume 114. Springer-Verlag, Berlin, 1981. Google ScholarDigital Library
- Butler Lampson. A description of the Cedar language: A Cedar language reference manual. Technical Report CSL-83-15, Xerox PARC, December 1983.Google Scholar
- B. Liskov, R. Atkinson, and R. Scheifler. Aspects of implementing CLU. In Proceedings of the Annual Conference. ACM, 1978. Google ScholarDigital Library
- Jed Liu and Andrew C. Myers. JMatch: Java plus pattern matching. Technical Report TR2002-1878, Computer Science Department, Cornell University, October 2002. Software release at http://www.cs.cornell.edu/projects/jmatch.Google Scholar
- Jed Liu and Andrew C. Myers. JMatch: Abstract iterable pattern matching for Java. In Proc. 5th Int'l Symp. on Practical Aspects of Declarative Languages (PADL), pages 110--127, New Orleans, LA, January 2003. Google ScholarDigital Library
- B. Liskov, A. Snyder, R. Atkinson, and J. C. Schaffert. Abstraction mechanisms in CLU. Comm. of the ACM, 20(8):564--576, August 1977. Also in S. Zdonik and D. Maier, eds., Readings in Object-Oriented Database Systems. Google ScholarDigital Library
- Andrew C. Myers, Joseph A. Bank, and Barbara Liskov. Parameterized types for Java. In Proc. 24th ACM Symp. on Principles of Programming Languages (POPL), pages 132--145, Paris, France, January 1997. Google ScholarDigital Library
- David R. Musser, Gillmer J. Derge, and Atul Saini. The STL Tutorial and Reference Guide. Addison-Wesley, 2nd edition, 2001. ISBN 0-201-37923-6. Google ScholarDigital Library
- Microsoft Corporation. Microsoft C# Language Specifications. Microsoft Press, 2001. ISBN 0-7356-1448-2. Google ScholarDigital Library
- Andrew C. Myers, Barbara Liskov, and Nicholas Mathewson. PolyJ: Parameterized types for Java. Software release, at http://www.cs.cornell.edu/polyj, July 1998.Google Scholar
- O. Lehrmann Madsen, B. Møller-Pedersen, and K. Nygaard. Object Oriented Programming in the BETA Programming Language. Addison-Wesley, June 1993. Google ScholarDigital Library
- Stephan Murer, Stephen Omohundro, David Stoutamire, and Clemens Szyperski. Iteration abstraction in Sather. ACM Transactions on Programming Languages and Systems, 18(1):1--15, January 1996. Google ScholarDigital Library
- Robin Milner, Mads Tofte, and Robert Harper. The Definition of Standard ML. MIT Press, Cambridge, MA, 1990. Google ScholarDigital Library
- Nathaniel Nystrom, Michael Clarkson, and Andrew C. Myers. Polyglot: An extensible compiler framework for Java. In Görel Hedin, editor, Compiler Construction, 12th International Conference, CC 2003, number 2622 in Lecture Notes in Computer Science, pages 138--152, Warsaw, Poland, April 2003. Springer-Verlag. Google ScholarDigital Library
- The SML/NJ Fellowship. Standard ML of New Jersey. http://www.smlnj.org/.Google Scholar
- B. Stroustrup. The C++ Programming Language. Addison-Wesley, 1987. Google ScholarDigital Library
- Sun Microsystems. JDK 5 Java Language Documentation, 2004. http://java.sun.com/j2se/1.5.0/docs/guide/language.Google Scholar
- M. Shaw, W. Wulf, and R. London. Abstraction and verification in Alphard: Defining and specifying iteration and generators. Comm. of the ACM, 20(8), August 1977. Google ScholarDigital Library
- Guido van Rossum. The Python Language Reference Manual. Network Theory, Ltd., September 2003. Google ScholarDigital Library
- Niklaus Wirth. Programming in Modula-2. Springer Verlag, Berlin, 3rd edition, 1985. Google ScholarDigital Library
- David H. D. Warren, Luis M. Pereira, and Fernando Pereira. Prolog--the language and its implementation compared with Lisp. In Proc. 1977 Symposium on Artificial Intelligence and Programming Languages, pages 109--115, 1977. Google ScholarDigital Library
Index Terms
- Interruptible iterators
Recommendations
Interruptible iterators
Proceedings of the 2006 POPL ConferenceThis paper introduces interruptible iterators, a language feature that makes expressive iteration abstractions much easier to implement. Iteration abstractions are valuable for software design, as shown by their frequent use in well-designed data ...
Efficient coroutines for the Java platform
PPPJ '10: Proceedings of the 8th International Conference on the Principles and Practice of Programming in JavaCoroutines are non-preemptive lightweight processes. Their advantage over threads is that they do not have to be synchronized because they pass control to each other explicitly and deterministically. Coroutines are therefore an elegant and efficient ...
Cedalion: a language for language oriented programming
OOPSLA '11Language Oriented Programming (LOP) is a paradigm that puts domain specific programming languages (DSLs) at the center of the software development process. Currently, there are three main approaches to LOP: (1) the use of internal DSLs, implemented as ...
Comments