HAL will be down for maintenance from Friday, June 10 at 4pm through Monday, June 13 at 9am. More information
Skip to Main content Skip to Navigation
Journal articles

FeatherTrait: A Modest Extension of Featherweight Java

Luigi Liquori 1 Arnaud Spiwack 2, 3
2 TYPICAL - Types, Logic and computing
Inria Saclay - Ile de France, LIX - Laboratoire d'informatique de l'École polytechnique [Palaiseau]
Abstract : In the context of statically-typed, class-based languages, we investigate classes that can be extended with trait composition. A trait is a collection of methods without state; it can be viewed as an incomplete stateless class. 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 (FTJ), a conservative extension of the simple lightweight class-based calculus Featherweight Java (FJ) with statically-typed traits. In FTJ, classes can be built using traits as basic behavioral bricks; method conflicts between imported traits must be resolved explicitly by the user either by (i) aliasing or excluding method names in traits, or by (ii) overriding explicitly the conflicting methods in the class or in the trait itself. We present an operational semantics with a lookup algorithm, and a sound type system that guarantees that evaluating a well-typed expression never yields a message-not-understood run-time error nor gets the interpreter stuck. We give examples of the increased expressive power of the trait-based inheritance model. The resulting calculus appears to be a good starting point for a rigorous mathematical analysis of typed class-based languages featuring trait-based inheritance.
Complete list of metadata

Cited literature [46 references]  Display  Hide  Download

Contributor : Arnaud Spiwack Connect in order to contact the contributor
Submitted on : Monday, November 16, 2009 - 3:52:47 PM
Last modification on : Friday, February 4, 2022 - 3:21:41 AM
Long-term archiving on: : Thursday, June 17, 2010 - 8:30:59 PM


Files produced by the author(s)




Luigi Liquori, Arnaud Spiwack. FeatherTrait: A Modest Extension of Featherweight Java. ACM Transactions on Programming Languages and Systems (TOPLAS), ACM, 2008, ACM Transactions on Programming Languages and Systems (TOPLAS), 30 (2), pp.11:1--11:32. ⟨10.1145/1330017.1330022⟩. ⟨inria-00432538⟩



Record views


Files downloads