case sensitive

Sort by: Display: Hide controls:

  1. Tom Cutsem, Alexandre Bergel, Stéphane Ducasse, and Wolfgang De Meuter. Adding State and Visibility Control to Traits using Lexical Nesting. In Sophia Drossopoulou (Ed.), Proceedings of European Conference on Object-Oriented Programming (ECOOP'09), Lecture Notes in Computer Science (5653) p. 220—243, Springer, London, UK, 2009. DOI 

    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.