Trait (computer programming)

This is an old revision of this page, as edited by JWB (talk | contribs) at 14:17, 4 June 2009 (scala refs). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

In computer programming, a trait is an abstract type, used as a "simple conceptual model for structuring object oriented programs".[1] Traits are similar to mixins, but may include definitions for class methods. Traits have been proposed for inclusion in Smalltalk, PHP, and ActionScript 3.0, and are found in Moose (Perl 5), Perl 6, Joose (JavaScript), and Scala. [2] [3] Module mixins in Ruby are similar to traits to some degree.

Traits were initially developed at the Software Composition Group, University of Berne.[4]

References