Reconciling virtual classes with genericity

  • Authors:
  • Erik Ernst

  • Affiliations:
  • Department of Computer Science, University of Aarhus, Denmark

  • Venue:
  • JMLC'06 Proceedings of the 7th joint conference on Modular Programming Languages
  • Year:
  • 2006

Quantified Score

Hi-index 0.00

Visualization

Abstract

Type abstraction in object-oriented languages mainly embodies two techniques with different strenghts and weaknesses. The first technique is extension, yielding abstraction mechanisms with good support for gradual specification; the prime example is inheritance. The second technique is functional abstraction, yielding more precise knowledge about the outcome; the prime example is type parameterized classes. This paper argues that they should be clearly separated to work optimally. We have applied this design philosophy to a language based on an extension mechanism, namely virtual classes. As a result, a kind of type parameters have been introduced, but they are simple and only used where they excel. Conversely, final definitions of virtual classes have been removed from the language, thus making virtual classes more flexible. The resulting language presents a clearer and more flexible trade-off between extensibility and predictability, empowering programmers to choose the right balance.