Pattern Matching and Interruptible Iterators for Java
The JMatch language extends Java with pattern matching that supports both data abstraction and iteration abstraction. Patterns are not tied to algebraic data constructors as in ML; instead, a single JMatch method may be used in several modes, some of which can serve as patterns. JMatch provides modal abstraction that simplifies the specification and implementation of abstract data types. These modes that may share a common implementation as a boolean formula. Thus, the specification, implementation, and use of iteration abstractions are made convenient, by automatically finding multiple solutions to a formula or pattern.
JMatch version 1.0 introduced interruptible iterators, a new language feature that makes iteration abstractions much easier to implement. The loop body controlled by the iterator may interrupt it with requests to perform work other than iteration. Interrupts are similar to exceptions, but propagate differently and have resumption semantics.
Publications and Reports
Chinawat Isradisaikul and Andrew C. Myers. Reconciling exhaustive pattern matching with objects. Proceedings of the ACM Conference on Programming Language Design and Implementation (PLDI'13), pp. 343–353, June 2013.
Jed Liu, Aaron Kimball, Andrew C. Myers. Interruptible Iterators, Proceedings of the 33rd ACM Symposium on Principles of Programming Languages (POPL'06), pp. 283–294, Jan. 2006.
Jed Liu, Andrew C. Myers. JMatch: Iterable Abstract Pattern Matching for Java, Proceedings of the 5th International Symposium on Practical Aspects of Declarative Languages (PADL'03), pp. 110–127, New Orleans, LA, Jan. 2003. LNCS 2562.
SupportThe development of the JMatch compiler has been supported by a number of funding sources, including ONR Grant N00014-01-1-0968, NSF Grant 0208642, an NSF CAREER award, and an Alfred P. Sloan Research Fellowship.
JMatch code examples