Revisiting parametric types and virtual classes

  • Authors:
  • Anders Bach Madsen;Erik Ernst

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

  • Venue:
  • TOOLS'10 Proceedings of the 48th international conference on Objects, models, components, patterns
  • Year:
  • 2010

Quantified Score

Hi-index 0.00

Visualization

Abstract

This paper presents a conceptually oriented updated view on the relationship between parametric types and virtual classes. The traditional view is that parametric types excel at structurally oriented composition and decomposition, and virtual classes excel at specifying mutually recursive families of classes whose relationships are preserved in derived families. Conversely, while class families can be specified using a large number of F-bounded type parameters, this approach is complex and fragile; and it is difficult to use traditional virtual classes to specify object composition in a structural manner, because virtual classes are closely tied to nominal typing. This paper adds new insight about the dichotomy between these two approaches; it illustrates how virtual constraints and type refinements, as recently introduced in gbeta and SCALA, enable structural treatment of virtual types; finally, it shows how a novel kind of dynamic type check can detect compatibility among entire families of classes.