Views: a way for pattern matching to cohabit with data abstraction
POPL '87 Proceedings of the 14th ACM SIGACT-SIGPLAN symposium on Principles of programming languages
A new look at pattern matching in abstract data types
Proceedings of the first ACM SIGPLAN international conference on Functional programming
Extensible algebraic datatypes with defaults
Proceedings of the sixth ACM SIGPLAN international conference on Functional programming
JMatch: Iterable Abstract Pattern Matching for Java
PADL '03 Proceedings of the 5th International Symposium on Practical Aspects of Declarative Languages
A Term Pattern-Match Compiler Inspired by Finite Automata Theory
CC '92 Proceedings of the 4th International Conference on Compiler Construction
When Do Match-compilation Heuristics Matter?
When Do Match-compilation Heuristics Matter?
Extensible pattern matching via a lightweight language extension
ICFP '07 Proceedings of the 12th ACM SIGPLAN international conference on Functional programming
Matching objects with patterns
ECOOP'07 Proceedings of the 21st European conference on Object-Oriented Programming
Static type analysis of pattern matching by abstract interpretation
FMOODS'10/FORTE'10 Proceedings of the 12th IFIP WG 6.1 international conference and 30th IFIP WG 6.1 international conference on Formal Techniques for Distributed Systems
Hi-index | 0.00 |
Pattern matching makes ML programs more concise and readable, and these qualities are also sought in object-oriented settings. However, objects and classes come with open class hierarchies, extensibility requirements and the need for data abstraction, which all conflict with matching on concrete data types. Extractor-based pattern matching has been proposed to address this conflict. Extractors are user-defined methods that perform the task of value discrimination and deconstruction during pattern matching. In this paper, we give the first formalization of extractor-based matching, using a first-order object-oriented calculus. We give a direct operational semantics and prove it sound. We then present an optimizing translation to a target language without matching, and prove a correctness result stating that an expression is equivalent to its translation.