[Issue 15335] getSymbolsByUDA fails if type has private members
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Tue Nov 17 19:15:00 PST 2015
https://issues.dlang.org/show_bug.cgi?id=15335
--- Comment #2 from ryan at rcorre.net ---
(In reply to bb.temp from comment #1)
> I've encountered a similar issue yesterday. It looks like the only way to
> solve this is to make `getSymbolsByUDA` a mixin template containing the
> current function.
Yeah, its messy. I'm not sure I'd want it to require users to mix in something,
but I'm at a loss for how else we can return actual symbols.
It _can_ be implemented if you just want to return member names:
template getMembersByUDA(T, alias attribute)
{
import std.meta : Filter;
enum hasSpecificUDA(string name) = mixin("hasUDA!(T."~name~", attribute)");
alias getMembersByUDA = Filter!(hasSpecificUDA, __traits(allMembers, T));
}
But then the user has to translate them to symbols using getMember on their
end.
--
More information about the Digitalmars-d-bugs
mailing list