Template mixins: Why is the decision to mixin made at the call site?

Jarrett Billingsley jarrett.billingsley at gmail.com
Fri Aug 21 10:47:53 PDT 2009


On Fri, Aug 21, 2009 at 1:36 PM, div0<div0 at users.sourceforge.net> wrote:
> Not sure what the original choice was based on, but what you suggest
> looks wrong to me. You aren't necessarily using a template in order to
> mix it in somewhere.
>
> With that syntax it looks like you can only use foo as a mixin.

That's what he's suggesting, and it does make sense.  When you write a
template, *either* it's meant to be used as a mixin, *or* it's meant
to be used some other way.  Mixin in a template that wasn't meant to
be a mixin or vice versa usually makes no sense.

> If you
> change 'mixin' to 'paste' your way round looks even more wrong.

If you're thinking of 'mixin' as a verb, "to mix in", I can understand
that.  But if you consider his syntax with "mixin" as a noun (like
"class" or "template"), it makes more sense.


More information about the Digitalmars-d-learn mailing list