Matching Objects with Patterns

  • Burak Emir
  • Martin Odersky
  • John Williams
Part of the Lecture Notes in Computer Science book series (LNCS, volume 4609)

Abstract

Data in object-oriented programming is organized in a hierarchy of classes. The problem of object-oriented pattern matching is how to explore this hierarchy from the outside. This usually involves classifying objects by their run-time type, accessing their members, or determining some other characteristic of a group of objects. In this paper we compare six different pattern matching techniques: object-oriented decomposition, visitors, type-tests/type-casts, typecase, case classes, and extractors. The techniques are compared on nine criteria related to conciseness, maintainability and performance. The paper introduces case classes and extractors as two new pattern-matching methods and shows that their combination works well for all of the established criteria.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

Copyright information

© Springer-Verlag Berlin Heidelberg 2007

Authors and Affiliations

  • Burak Emir
    • 1
  • Martin Odersky
    • 1
  • John Williams
    • 2
  1. 1.EPFL, 1015 LausanneSwitzerland
  2. 2.Language Computer Corporation, Richardson TX 75080USA

Personalised recommendations