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

Alexandru Ermicioi via Digitalmars-d digitalmars-d at puremagic.com
Mon Sep 5 01:09:27 PDT 2016


On Monday, 5 September 2016 at 07:48:11 UTC, Johannes Pfau wrote:
> Am Sun, 4 Sep 2016 14:54:33 +0200
> schrieb Andrei Alexandrescu <SeeWebsiteForEmail at erdani.org>:
>
>> On 9/4/16 2:37 PM, David Nadlinger wrote:
>> > [...]
>> 
>> Static introspection is by far the most powerful feature of D. 
>> The last thing to do with it is hamstring it with nonsense 
>> like private :o).
>> 
>> Quoting elsethread:
>> 
>> > [...]
>> 
>> 
>> Andrei
>
> All these examples need access to private data fields only.
> Most performance optimizations are only possible for private 
> functions
> anyway. So is there a use case to access/call private functions?

One use case would be accessing UDA on private fields, to inspect 
which fields need to be injected with a dependency, in aggregate 
type, just like spring from java does with autowire annotation. 
You mark a private field with autowired, and spring calls 
associated setter for the field.

Does tupleof allow access to associated UDAs of contained fields, 
as well field names?


More information about the Digitalmars-d mailing list