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

Stefan Koch via Digitalmars-d digitalmars-d at puremagic.com
Sat Sep 3 20:21:05 PDT 2016


On Sunday, 4 September 2016 at 03:14:18 UTC, Martin Nowak wrote:
>
> It didn't slip, but I wish Walter had at least stated his 
> opinion on the PR before merging.
>
>> My thinking is that the plebes should be able to access things 
>> via the object.member syntax by obeying the usual visibility 
>> rules. But __traits(allMembers, T) should be the reflection 
>> backdoor that gives the savvy users total access, at the 
>> obvious cost of an awkward syntax.
>
> As explained several times here and in the announce thread, 
> private members have never been accessible, other than 
> introspecting attributes, and making them accessible comes with 
> a performance cost and a fairly big language change.
> So the real question is, why do we need introspection without 
> access, and can we handle that few cases with mixin templates.
> If we really need introspection of private members than we 
> might need to go back to the drawing board and modify the 
> visibility concept introduced with DIP22.

While I do understand, that there could be a potential 
performance when  private members could be changed around because 
they are not visible form outside.

I fail to see how we would take advantage of that without 
breaking our object-model.




More information about the Digitalmars-d mailing list