Hacker News new | past | comments | ask | show | jobs | submit login

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'.






This “mixin” concept uses the CRTP pattern, as mentioned in the post: 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.


And just use concepts and call it a day.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: