Automatic Interface Implementation

Vladimir Panteleev vladimir at thecybershadow.net
Fri Jul 5 15:33:00 PDT 2013


On Friday, 5 July 2013 at 17:53:11 UTC, JS wrote:
> I ripped and hacked up some code from typecons that allows one 
> to implement an interface automatically by redirecting it to a 
> variable implementing the interface.

How about splitting up the implementation of AutoImplement into a 
template mixin, which would then be usable on its own?

Some previous discussion on the topic:

http://forum.dlang.org/post/20100909021137.40d2dce2.rsinfu@gmail.com

The new "wrap" from std.typecons looks like it might help, 
however:
1) The type it creates is completely inaccessible (the return 
type is the interface);
2) It doesn't seem to play well with "alias this". Instead of 
wrapping methods in the struct containing "alias this", it uses 
the methods (with the same name/signature) from the object "alias 
this" points to.


More information about the Digitalmars-d mailing list