Mixins vs. Traits
问题 What is the difference between Mixins and Traits? According to Wikipedia, Ruby Modules are sort of like traits. How so? 回答1: Mixins may contain state, (traditional) traits don't. Mixins use "implicit conflict resolution", traits use "explicit conflict resolution" Mixins depends on linearization, traits are flattened. Lecture about traits ad 1. In mixins you can define instance variables. Traits do not allow this. The state must be provided by composing class (=class using the traits) ad 2.