Skip to Main content Skip to Navigation
Conference papers

Adding State and Visibility Control to Traits using Lexical Nesting

Tom van Cutsem 1 Alexandre Bergel 2 Stéphane Ducasse 2, * Wolfgang de Meuter 1
* Corresponding author
2 RMOD - Analyses and Languages Constructs for Object-Oriented Application Evolution
LIFL - Laboratoire d'Informatique Fondamentale de Lille, Inria Lille - Nord Europe
Abstract : Traits are reusable building blocks that can be composed to share methods across unrelated class hierarchies. Original traits are stateless and cannot express visibility control for methods. Two extensions, stateful traits and freezable traits, have been proposed to overcome these limitations. However, these extensions introduce complexity and have not yet been combined to simultaneously add both state and visibility control to traits. This paper revisits the addition of state and visibility control to traits. Rather than extending the original traits model with additional operations, we allow traits to be lexically nested within other modules. Traits can then have (shared) state and visibility control by hiding variables or methods in their lexical scope. Although the Traits' “flattening property” has to be revisited, the combination of traits with lexical nesting results in a simple and expressive trait model. We discuss an implementation of the model in AmbientTalk and specify its operational semantics.
Document type :
Conference papers
Complete list of metadata

Cited literature [33 references]  Display  Hide  Download
Contributor : Lse Lse Connect in order to contact the contributor
Submitted on : Wednesday, July 7, 2010 - 2:24:50 PM
Last modification on : Thursday, January 20, 2022 - 5:30:21 PM
Long-term archiving on: : Tuesday, October 23, 2012 - 10:05:17 AM


Files produced by the author(s)


  • HAL Id : inria-00498397, version 1



Tom van Cutsem, Alexandre Bergel, Stéphane Ducasse, Wolfgang de Meuter. Adding State and Visibility Control to Traits using Lexical Nesting. ECOOP, Jul 2009, Genova, Italy. ⟨inria-00498397⟩



Les métriques sont temporairement indisponibles