What is the difference between Mixins and Traits?
According to Wikipedia, Ruby Modules are sort of like traits. How so?
What is the difference between Mixins and Traits?
According to Wikipedia, Ruby Modules are sort of like traits. How so?
These pages explain the difference in the D Programming language.
http://www.digitalmars.com/d/2.0/mixin.html
http://www.digitalmars.com/d/2.0/traits.html
Mixins in this context are code generated on the fly, and then inserted at that point in code during compilation. Quite handy for simple DSLs.
Traits are compile-time external values (rather than code generated from an external source). The difference is subtle. Mixins add logic, Traits add data such as compile-time type information.
Don't know much about Ruby, but hope this helps somewhat.