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

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Mon Sep 5 02:05:18 PDT 2016


On 9/5/16 10:38 AM, Jacob Carlborg wrote:
> On 2016-09-04 14:36, Andrei Alexandrescu wrote:
>
>> Yah, .tupleof is great to have. I think that should be enough for most
>> introspection needs. Only the field names are missing, can those be
>> accessed somehow? -- Andrei
>
> Yes:
>
> module foo;
>
> struct Foo
> {
>     private int a;
> }
>
> module main;
>
> import foo;
> static assert(__traits(identifier, Foo.tupleof[0]) == "a");

Thank you. This is good news. -- Andrei



More information about the Digitalmars-d mailing list