3 ms·
In a language with ad-hoc polymorphism like C++, mixins seems entirely unnecessary. You can just declare by convention that a freestanding clone(T x) -> T func
by cisters 2y ago
In a language with ad-hoc polymorphism like C++, mixins seems entirely unnecessary.
You can just declare by convention that a freestanding clone(T x) -> T function should exist for it to be 'cloneable'.
- Rucadi 2y agoAnd just use concepts and call it a day.
- cgh 2y agoThis “mixin” concept uses the CRTP pattern, as mentioned in the post: https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern https://en.wikipedia.org/wiki/Curiously_recurring_template_p... It actually does have specific applications. That Wikipedia article shows a good example of polymorphic method chaining. In a former life, I worked with Microsoft’s Active Template Library, which is entirely based on this pattern.