change mixins

Michel Fortin michel.fortin at michelf.com
Sun Feb 14 14:37:38 PST 2010


On 2010-02-14 16:31:29 -0500, Walter Bright <newshound1 at digitalmars.com> said:

> 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?

Me likes it. :-)

To me it was confusing at first that templates could be used both way. 
I've rarely seen a template that is meant to be and not to be mixed-in 
at the same time, so this will make things clearer (and also enforce) 
how a particular template is meant to be used. And I won't say no to 
reducing the clutter at the usage point.

I only hope you can still use it without the 'handle' part. :-)


-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/




More information about the Digitalmars-d mailing list