www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Template resolution and interfaces

reply "Torje Digernes" <torjehoa pvv.org> writes:
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?
Dec 10 2013
parent reply "qznc" <qznc web.de> writes:
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?
Dec 11 2013
parent "Torje Digernes" <torjehoa pvv.org> writes:
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.
Dec 11 2013