Talk:Trait (computer programming)

From Wikipedia, the free encyclopedia
Jump to: navigation, search
WikiProject Computing  
WikiProject icon This article is within the scope of WikiProject Computing, a collaborative effort to improve the coverage of computers, computing, and information technology on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
 ???  This article has not yet received a rating on the project's quality scale.
 ???  This article has not yet received a rating on the project's importance scale.

Proposed Deletion[edit]

I would propose this article be merged into Abstract Types rather than sitting on its own. Traits are a behavoir variant of abstract types. EvanCarroll (talk) 20:04, 23 June 2009 (UTC)

That's like merging shark with animal. The abstract type article links to but does not incorporate the Interface (computer science), Trait (computer science), and mixin articles, and that's as it should be. -- (talk) 09:24, 30 October 2010 (UTC)

"Traits come from the Self programming language" <-- evidence? Schaerli et al at the SCG implemented traits in Smalltalk (Squeak 3.9, to be precise). --Frank Shearar (talk) 20:07, 28 July 2011 (UTC)

"Traits come from the Self programming language" <-- I think this is wrong. self does have a thing conventionally called "traits" but it not the same kind of thing as this page is speaking of. — Preceding unsigned comment added by (talk) 20:35, 28 July 2011 (UTC)

"Traits come from the Self programming language" <-- I coined the term "trait", in this usage, as a developer/manager on the Xerox "Star" in 1979/80. Object-orientation, classes and traits were implemented as coding patterns over the system language Mesa. Conceptually, they were atomic packages of methods, antecedent to "class". Concept was influenced by ideas from Smalltalk/multiple inheritance and polymorphism at PARC. Fine grained reuse seemed necessary for Star because the target operating environment was so small (e.g., .5MB-.75MB main memory). I published a Xerox PARC "blue-and-white" report on traits in 1981/2, and published at SIGOA the following year [1] GCurry (talk) 21:36, 10 October 2011 (UTC)

I support GCurry's comment above. I've discussed this with the researchers who implemented traits in Smalltalk and they said Gael Curry and Xerox Star is where traits began (source is personal email discussion). They also point to: G. Curry, L. Baer, D. Lipkie, and B. Lee. Traits: An approach to multiple-inheritance subclassing. In SIGOA conference on Office Information Systems, pages 1–9, Philadelphia, Pennsylvannia, USA, 1982. ACM Press"" --Overseasexile (talk) 20:11, 27 January 2013 (UTC)

Trait with variables?[edit]

"Does not specify any state variables."

Really? Some Scala traits do:

It is funny that Scala is listed in examples of such languages, although Scala's traits are different from described traits. — Preceding unsigned comment added by V6ak (talkcontribs) 11:38, 7 June 2012 (UTC)

Most people understand traits from the Smalltalk research in this field and the original Smalltalk implementation specifically excluded traits having state. Since then the researchers realized this was an error, but I don't believe there's been any definitive method (no pun intended) of describing how state should be implemented. --Overseasexile (talk) 19:53, 27 January 2013 (UTC)

There are several extensions dealing with adding state to traits (though it seems this is a recent development). I've added a reference to AmbientTalk, which offers a homogeneous way to handle state and visibility of variables. Diego (talk) 12:45, 28 January 2013 (UTC)

On this topic, I find it quite confusing as a reader to introduce traits by saying they don't usually carry state and conclude with a PHP example that actually does — (talk) 13:28, 12 October 2015 (UTC)

Groovy, Ruby, and JavaScript also support state variables. — Preceding unsigned comment added by (talk) 17:46, 15 February 2016 (UTC)

  1. ^ Traits: An Approach to Multiple-Inheritance Subclassing; GCurry et al; Philadelphia; June 1982