April 24, 2005
This was originally on comp.lang.c++.moderated:

"Robert Kindred" <RKindred@SwRI.edu> wrote in message news:116a3fter9qeq07@corp.supernews.com...
> I know of no other language [besides C++] capable of the Curiously Recurring Template Pattern (Leda does not count).

Here's the wiki entry on the CRTP:

http://c2.com/cgi/wiki?CuriouslyRecurringTemplate

and the D Programming Language implementation of it:

class ArithmeticType(T)
{
    T opAdd(T other)
    {
        T result = new T(this);
        result += other;
        return result;
    }
}

class Quaternion: ArithmeticType!(Quaternion)
{
    this() { }
    this(ArithmeticType!(Quaternion) t) { }

    Quaternion opAddAssign(Quaternion other)
    {
         // etc.
    }
}

So now there are two languages that can do the CRTP <g>.


April 24, 2005
"Walter" <newshound@digitalmars.com> wrote in message news:d4f1o0$2s4n$1@digitaldaemon.com...
> This was originally on comp.lang.c++.moderated:
>
*snip*
>
> http://c2.com/cgi/wiki?CuriouslyRecurringTemplate
>
> and the D Programming Language implementation of it:
>
> class ArithmeticType(T)
> {
>     T opAdd(T other)
>     {
>         T result = new T(this);
>         result += other;
>         return result;
>     }
> }
>
> class Quaternion: ArithmeticType!(Quaternion)
> {
>     this() { }
>     this(ArithmeticType!(Quaternion) t) { }
>
>     Quaternion opAddAssign(Quaternion other)
>     {
>          // etc.
>     }
> }
>
> So now there are two languages that can do the CRTP <g>.
>
>

Cool!  Thanks for pointing this out.  :)