The JMatch language extends Java with support for abstract iterable pattern matching: a mechanism for pattern matching that is compatible with the data abstraction features of Java and also makes iteration abstractions convenient to use and to implement. JMatch provides abstract pattern matching; patterns are not tied to algebraic data constructors as in ML. A single JMatch method may be used in several modes that may share a common implementation as a boolean formula. JMatch provides modal abstraction that simplifies the specification and implementation of abstract data types. JMatch also makes the specification, implementation, and use of iteration abstractions convenient, by automatically finding multiple solutions to a formula or pattern.
We are used to seeing pattern mathcing facilites in functional languages, however the design of JMatch is in some respects closer to the classic pattern matching facilities found in logic programming languages. In particular, method parameters can serve a dual role: for some calls they are treated as input parameters, and in others the same parameters are treated as output parameters and computation is reversed.
It seems that the JMatch approach, by making Java more declerative, helps specify the algebraic properties of ADTs more consistently than is possible using just imperative code.
JMatch is implemented using the Polyglot extensible Java compiler framework.
Posted to OOP by Ehud Lamm on 1/6/03; 2:45:43 PM
|
|