Translation correctness for first-order object-oriented pattern matching

  • Authors:
  • Burak Emir;Qin Ma;Martin Odersky

  • Affiliations:
  • Google Switzerland GmbH, Zürich, Switzerland and EPFL, Lausanne, Switzerland;OFFIS, Oldenburg, Germany;EPFL, Lausanne, Switzerland

  • Venue:
  • APLAS'07 Proceedings of the 5th Asian conference on Programming languages and systems
  • Year:
  • 2007

Quantified Score

Hi-index 0.00

Visualization

Abstract

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.