Request: traits isImplemented
Jacob Carlborg
doob at me.com
Fri Jul 5 03:55:25 PDT 2013
On 2013-07-05 11:52, JS wrote:
> I have a request to add to __traits to check if a method/property of a
> class/struct is actually implemented or not.
>
> interface A { void myfunc(); }
>
> class B : A { } // myfunc not implemented
> class C : A { void myfunc() { ... } // myfunc implemented
>
> This may seem odd but I need it for conditional mixin compilation to add
> in the methods when they are not implemented. A sort of default proxy,
> wrapper, or composite pattern implementer. It reduces boilerplate code
> significantly.
>
> Unfortunately allMembers returns methods that are not actually
> implemented or part of the class.
>
> Something like allImmediateMembers would be useful where it only returns
> the actually explicit members of the immediate class/struct that it is
> used on and accomplish the same task.
derivedMembers perhaps:
http://dlang.org/traits.html#derivedMembers
--
/Jacob Carlborg
More information about the Digitalmars-d
mailing list