'Mixins vs. Traits

What is the difference between Mixins and Traits?

According to Wikipedia, Ruby Modules are sort of like traits. How so?



Solution 1:[1]

These pages explain the difference in the D Programming language.

http://dlang.org/mixin.html

http://dlang.org/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.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 fooquency