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 metadatas

Cited literature [33 references]  Display  Hide  Download

https://hal.inria.fr/inria-00498397
Contributor : Lse Lse <>
Submitted on : Wednesday, July 7, 2010 - 2:24:50 PM
Last modification on : Tuesday, August 20, 2019 - 6:14:02 PM
Long-term archiving on : Tuesday, October 23, 2012 - 10:05:17 AM

File

Cuts09a-ECOOP09-Traits.pdf
Files produced by the author(s)

Identifiers

  • HAL Id : inria-00498397, version 1

Citation

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⟩

Share

Metrics

Record views

346

Files downloads

252