Making external types available to mixins

John Chapman johnch_atms at hotmail.com
Fri Nov 23 10:11:41 UTC 2018


On Thursday, 22 November 2018 at 16:27:08 UTC, Eduard Staniloiu 
wrote:
> So I had a go at this and I have a working solution.
> https://run.dlang.io/is/oaH6Ib
>
> At first, I tried to do everything in the mixin, as you can see 
> with the `failedAttempt` function. The idea was that this 
> should have worked like `mixin(failedAttempt!"Calendar"(1, 2, 
> 3));`. As you can see, and the name suggests, I wasn't able to 
> make it work with `args`.
>
> The solution I have to your problem is to use a template, in 
> this case the `theType` template that will expand to the fully 
> qualified name. So you'd use it like
> `makeWith!(theType!"Calendar")(args);`
>
> Hope it helps!
>
> Edi

Thanks!


More information about the Digitalmars-d-learn mailing list