change mixins

Simen kjaeraas simen.kjaras at gmail.com
Mon Feb 15 04:11:06 PST 2010


Walter Bright <newshound1 at digitalmars.com> wrote:

> Right now, mixins are defined and used as:
>
>     template foo(T) { declarations... }
>
>     mixin foo!(int) handle;
>
> The proposal is to switch it around:
>
>     mixin template foo(T) { declarations... }
>
>     foo!(int) handle;
>
> to follow the notion that mixin templates are very different from  
> regular templates, and that should be reflected in their definition  
> rather than use.
>
> What do you think?

I wholeheartedly support this.

As for the criticisms given by many here, one usage I have often
encountered is the 'pseudo-type' - a mixin'ed template that offers
behavior close to that of embedding a struct, but with better access
to its context.

-- 
Simen



More information about the Digitalmars-d mailing list