University of Limerick Institutional Repository

Stateful traits and their formalization

DSpace Repository

Show simple item record

dc.contributor.author Bergel, Alexandre
dc.contributor.author Ducasse, Stéphane
dc.contributor.author Nierstrasz, Oscar
dc.contributor.author Wuyts, Roel
dc.date.accessioned 2012-03-20T16:04:17Z
dc.date.available 2012-03-20T16:04:17Z
dc.date.issued 2008
dc.identifier.uri http://hdl.handle.net/10344/2107
dc.description peer-reviewed en_US
dc.description.abstract Traits offer a fine-grained mechanism to compose classes from reusable components while avoiding problems of fragility brought by multiple inheritance and mixins. Traits as originally proposed are stateless, that is, they contain only methods, but no instance variables. State can only be accessed within stateless traits by accessors, which become required methods of the trait. Although this approach works reasonably well in practice, it means that many traits, viewed as software components, are artificially incomplete, and classes that use such traits may contain significant amounts of boilerplate glue code. We present an approach to stateful traits that is faithful to the guiding principle of stateless traits: the client retains control of the composition. Stateful traits consist of a minimal extension to stateless traits in which instance variables are purely local to the scope of a trait, unless they are explicitly made accessible by the composing client of a trait. We demonstrate by means of a formal object calculus that adding state to traits preserves the flattening property: traits contained in a program can be compiled away. We discuss and compare two implementation strategies, and briefly present a case study in which stateful traits have been used to refactor the trait-based version of the Smalltalk collection hierarchy. en_US
dc.language.iso eng en_US
dc.publisher Association for Computing Machinery en_US
dc.relation.ispartofseries Computer Languages, Systems and Structures;34(2-3), pp. 83-108
dc.relation.uri http://dx.doi.org/10.1016/j.cl.2007.05.003
dc.rights "© ACM,2008. This is the author's version of the work. It is posted here by permission of ACM for your personal use. Not for redistribution. The definitive version was published in Computer, Languages, Systems and Structures 34(2-3), pp. 83-108. http://dx.doi.org/10.1016/j.cl.2007.05.003 en_US
dc.subject traits en_US
dc.subject multiple inheritance en_US
dc.subject eiffel en_US
dc.subject mixins en_US
dc.title Stateful traits and their formalization en_US
dc.type Article en_US
dc.type.supercollection all_ul_research en_US
dc.type.supercollection ul_published_reviewed en_US
dc.type.restriction none en
dc.contributor.sponsor Swiss National Science Foundation Recast
dc.contributor.sponsor Cook ANR French projects
dc.contributor.sponsor SFI
dc.relation.projectid SNF 2000-06165/001


Files in this item

This item appears in the following Collection(s)

Show simple item record

Search ULIR


Browse

My Account

Statistics