Traits are reusable building blocks that can be composed to share methods across class hierarchies. In their original form, traits are stateless and cannot express visibility control for methods. Two extensions, stateful and freezable traits, have been proposed to overcome these limitations. However, these extensions introduce complexity and have not before been combined to add both state and visibility control to traits.

Rather than extending the original traits model with additional operations, we discuss how state and visibility control can be added to traits by allowing them to be lexically nested within other modules. Although the Traits' flattening property no longer holds when traits can be lexically nested, the resulting model is simple and more expressive than the original. We specify an operational semantics and discuss an implementation of lexically nested traits in AmbientTalk, where they have been used in the development of a Morphic-like UI framework.
Original languageEnglish
Title of host publicationProceedings of the 23rd European Conference on Object-oriented Programming (ECOOP)
EditorsSophia Drossopoulou
PublisherSpringer Verlag
Pages220-243
Number of pages24
Volume5653
ISBN (Print)978-3-642-03012-3
Publication statusPublished - Jul 2009
EventFinds and Results from the Swedish Cyprus Expedition: A Gender Perspective at the Medelhavsmuseet - Stockholm, Sweden
Duration: 21 Sep 200925 Sep 2009

Publication series

NameLecture Notes in Computer Science

Conference

ConferenceFinds and Results from the Swedish Cyprus Expedition: A Gender Perspective at the Medelhavsmuseet
CountrySweden
CityStockholm
Period21/09/0925/09/09

    Research areas

  • traits, lexical nesting, object composition, AmbientTalk, language design

ID: 1813937