Question about Mixin.

monarch_dodra monarchdodra at gmail.com
Thu Jun 20 09:06:52 PDT 2013


On Wednesday, 19 June 2013 at 23:44:12 UTC, Jonathan M Davis 
wrote:
>
> Ah, you're right. That will work. I misread the question. I 
> thought that he
> was asking whether mixins in the base class magically got mixed 
> in again into
> the derived class, which they don't.
>
> - Jonathan M Davis

yeah, that's the "curiously recursive template pattern". The 
thing is that all these classes don't actually derive from a 
common base. The fact that they have a base class is only an 
implementation detail.

This trick is used a lot in C++, but in D, I really don't see 
what you get doing this over a simple template mixin (appart from 
not being able to have a "true" base class)...


More information about the Digitalmars-d-learn mailing list