https://issues.dlang.org/show_bug.cgi?id=15335

--- Comment #2 from [email protected] ---
(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.

--

Reply via email to