Template resolution and interfaces

Torje Digernes torjehoa at pvv.org
Wed Dec 11 10:33:47 PST 2013


On Wednesday, 11 December 2013 at 10:10:11 UTC, qznc wrote:
> On Tuesday, 10 December 2013 at 17:50:45 UTC, Torje Digernes 
> wrote:
>> http://pastie.org/8542555
>>
>> Compositing an class via curry fails when I try to use 
>> interfaces.
>>
>> Guessing that this is due to when classes are validated for
>> interface implementation and when templates are instantiated.
>>
>> I thought this was a cool optional way to build/composite 
>> classes
>> instead of wrappers. Don't think it has inherent advantages
>> (except that trivial wrappers look silly), just another way to 
>> do
>> it. Any chance I can do this anytime soon? Or already by 
>> writing
>> somewhat smarter?
>
> Your code creates an alias, which only exists at compile-time 
> but not at run-time. The compiler error "interface function 
> 'void mpriority()' is not implemented" is correct.
>
> A naive implementation is straightforward:
>
> void mpriority() { priority(myData); }
>
> Why do you want to use curry?

No other reason than that it looks cleaner to me than wrappers. I
tried it because I thought it should work, as I could call it by
that name, but I now see the problem.


More information about the Digitalmars-d-learn mailing list