Thread overview | |||||
---|---|---|---|---|---|
|
December 10, 2013 Template resolution and interfaces | ||||
---|---|---|---|---|
| ||||
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? |
December 11, 2013 Re: Template resolution and interfaces | ||||
---|---|---|---|---|
| ||||
Posted in reply to Torje Digernes | 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?
|
December 11, 2013 Re: Template resolution and interfaces | ||||
---|---|---|---|---|
| ||||
Posted in reply to qznc | 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.
|
Copyright © 1999-2021 by the D Language Foundation