[Issue 15335] getSymbolsByUDA fails if type has private members

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Nov 23 05:19:45 PST 2015


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

--- Comment #4 from ryan at rcorre.net ---
(In reply to bb.temp from comment #3)

> (actually there's --0-- mixin template in phobos so
> I doubt they'll ever accept some new functions based on this, even if it
> works).

Actually, Proxy is a mixin template. Still, it actually makes sense there,
whereas using a mixin template for this feels a bit hackier.

> Maybe the real solution would be to make "__traits(getMember,...)", and more
> generally speaking all the traits verbs that might also block compilation
> because of this, able to return any member, regardless of the protection.

Yeah, it would be nice if getMember could distinguish between 'referring' to a
member and 'accessing' a member. As a matter of fact, you _can_ do this, as my
getMembersByUDA example shows. You can inspect SomeType.privateMember by
building the expression out of a mixin; I just don't know if you can translate
that to a symbol without violating privacy.

--


More information about the Digitalmars-d-bugs mailing list