Usability of "allMembers and derivedMembers traits now only return visible symbols"

Martin Nowak via Digitalmars-d digitalmars-d at puremagic.com
Sat Sep 3 08:35:19 PDT 2016


On Tuesday, 30 August 2016 at 22:24:12 UTC, Ali Çehreli wrote:
> I can't wrap my head around the fact that a library template 
> called by my module cannot see my private members.

Well, it was never possible to access them either, didn't seem to 
cause much confusion. Also getSymbolsByUDA is built on a hack 
around that access check 
https://github.com/dlang/phobos/blob/cb09746cb11bcbe7b730f05d29792e6252669175/std/traits.d#L6979.
Note that you can pass private symbols to templates, so 
`hasUDA!(S.invisible, UDA)` works fine.
I don't see any other examples where we'll have much issues with 
that change other than w/ this weird getSymbolsByUDA API, which 
aliases to !(S.field, S.func, S.Nested).
Most templates operating on wholes types already didn't have 
access to private members.


More information about the Digitalmars-d mailing list