Extending FeatherTrait Java with Interfaces

  • Authors:
  • Luigi Liquori;Arnaud Spiwack

  • Affiliations:
  • INRIA Sophia Antipolis - Méditerranée, 2004 Route des Lucioles - BP 93, FR-06902 Sophia Antipolis, France;École Normale Supérieur de Cachan, 61, avenue du Président Wilson, 94235 Cachan Cedex, France

  • Venue:
  • Theoretical Computer Science
  • Year:
  • 2008

Quantified Score

Hi-index 5.23

Visualization

Abstract

In the context of Featherweight Java by Igarashi, Pierce, and Wadler, and its recent extension FeatherTrait Java (FTJ) by the authors, we investigate classes that can be extended with trait composition. A trait is a collection of methods, i.e., behaviors without state; it can be viewed as an ''incomplete stateless class'' i.e., an interface with some already written behavior. Traits can be composed in any order, but only make sense when ''imported'' by a class that provides state variables and additional methods to disambiguate conflicting names arising between the imported traits. We introduce FeatherTrait Java with Interfaces (iFTJ), where traits need to be typechecked only once, which is necessary for compiling them in isolation, and considering them as regular types, like Java-interfaces with a behavioral content.