Trait (computer programming): Difference between revisions

Content deleted Content added
scala refs
actual first
Line 1:
In [[computer programming]], a '''trait''' is an [[abstract type]], used as a "simple conceptual model for structuring [[object oriented]] programs".<ref>http://web.cecs.pdx.edu/~black/publications/TR_CSE_02-012.pdf</ref> Traits are similar to [[mixin]]s, but may include definitions for class methods.

Traits haveare beensupported proposedas fora inclusionnative inlanguage [[Smalltalk]], [[PHP]], and [[ActionScript|ActionScript 3.0]], and are foundfeature in [[Moose (Perl)|Moose]] ([[Perl]] 5), [[Perl 6]], [[Joose (framework)|Joose]] ([[JavaScript]]), and the [[Scala programming language|Scala]].
<ref>http://www.scala-lang.org/node/126 A Tour of Scala: Traits</ref>
<ref>http://www.ibm.com/developerworks/java/library/j-scala04298.html The busy Java developer's guide to Scala: Of traits and behaviors</ref>
and in [[Perl 6]] (where they are named "roles"),
as an add-on by the [[Moose (Perl)|Moose]] module for [[Perl 5]] and the [[Joose framework]] for [[JavaScript]],
and have been proposed for inclusion in [[Smalltalk]], [[PHP]], and [[ActionScript|ActionScript 3.0]].
''Module mixins'' in [[Ruby (programming language)|Ruby]] are similar to traits to some degree.