Symmetric encapsulated multi-methods to abstract over application structure

  • Authors:
  • David Lievens;William Harrison

  • Affiliations:
  • Trinity College, Dublin, Ireland;Trinity College, Dublin, Ireland

  • Venue:
  • Proceedings of the 2009 ACM symposium on Applied Computing
  • Year:
  • 2009

Quantified Score

Hi-index 0.00

Visualization

Abstract

In object systems, classes take the role of modules, and interfaces consist of methods. Because methods are encapsulated in objects, interfaces in object systems do not allow abstracting over where methods are implemented. This implies that any change to the implementation structure may cause a rippling effect. Sometimes this unduly restricts the scope of software evolution, in particular for methods with multiple parameters where there is no clear owner. We propose a simple scheme where symmetric methods may be defined in the classes of any of their parameters. This allows client code to be oblivious of what class contains a method implementation, and therefore immune against it changing. When combined with multiple dynamic dispatch, this scheme allows for modular extensibility (but not modular type-checking) where a method defined in one class is overridden by a method defined in a class that is not its subtype. In this paper, we illustrate the scheme by extending a core calculus of class-based languages with these symmetric encapsulated multi-methods, and prove the result sound.