Template mixins and struct constructors
Adrian Matoga via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Mar 3 03:53:22 PST 2016
On Wednesday, 2 March 2016 at 20:39:57 UTC, Adam D. Ruppe wrote:
> On Wednesday, 2 March 2016 at 12:27:04 UTC, Adrian Matoga wrote:
>> Is it by design or is it a bug?
>> And, if it is by design, what is the reason for that?
>
> That's by design. It allows you to override names from a
> template mixin like inheritance but no runtime cost.
>
> Read my tip of the week here to see how it works and how you
> can combine ctors from a mixin:
>
> http://arsdnet.net/this-week-in-d/2016-feb-07.html
Ah, I was on vacation at that time so that's why I don't remember
reading it. :)
Thanks! It's a nice workaround but it's, well, a workaround. It
leaks the internals of the template mixin and a potential API
user would have to remember two additional quirks when using it.
I guess I'll try a different approach, initializing the mixed in
members later with a function.
More information about the Digitalmars-d-learn
mailing list