Reconciling exhaustive pattern matching with objects

Autor: Chinawat Isradisaikul, Andrew C. Myers
Rok vydání: 2013
Předmět:
Zdroj: PLDI
ISSN: 1558-1160
0362-1340
DOI: 10.1145/2499370.2462194
Popis: Pattern matching, an important feature of functional languages, is in conflict with data abstraction and extensibility, which are central to object-oriented languages. Modal abstraction offers an integration of deep pattern matching and convenient iteration abstractions into an object-oriented setting; however, because of data abstraction, it is challenging for a compiler to statically verify properties such as exhaustiveness. In this work, we extend modal abstraction in the JMatch language to support static, modular reasoning about exhaustiveness and redundancy. New matching specifications allow these properties to be checked using an SMT solver. We also introduce expressive pattern-matching constructs. Our evaluation shows that these new features enable more concise code and that the performance of checking exhaustiveness and redundancy is acceptable.
Databáze: OpenAIRE