Re: tupleof of class instance... but enumerate _all_ the instance variables

2025-06-30 Thread Andy Valencia via Digitalmars-d-learn
On Monday, 30 June 2025 at 21:37:20 UTC, bauss wrote: static foreach (field; B.tupleof) {{ enum s = __traits(identifier, field); pragma(msg, s); // access runtime field __traits(getMember, d, s)++;

Re: tupleof of class instance... but enumerate _all_ the instance variables

2025-06-30 Thread bauss via Digitalmars-d-learn
On Monday, 30 June 2025 at 16:37:01 UTC, Andy Valencia wrote: On Saturday, 28 June 2025 at 10:41:47 UTC, Nick Treleaven wrote: static foreach (field; B.tupleof) {{ enum s = __traits(identifier, field); pragma(msg, s); // acc

Re: tupleof of class instance... but enumerate _all_ the instance variables

2025-06-30 Thread Andy Valencia via Digitalmars-d-learn
On Saturday, 28 June 2025 at 10:41:47 UTC, Nick Treleaven wrote: static foreach (field; B.tupleof) {{ enum s = __traits(identifier, field); pragma(msg, s); // access runtime field __traits(getMember, d, s)++;

Re: tupleof of class instance... but enumerate _all_ the instance variables

2025-06-29 Thread Nick Treleaven via Digitalmars-d-learn
On Sunday, 29 June 2025 at 03:50:03 UTC, Andy Valencia wrote: On Saturday, 28 June 2025 at 10:41:47 UTC, Nick Treleaven wrote: static if (is(D Bases == super)) Wow. I can't find that in _any_ of my references on D... including the language spec itself. Nor in Phobos source... what is

Re: tupleof of class instance... but enumerate _all_ the instance variables

2025-06-28 Thread Ali Çehreli via Digitalmars-d-learn
On 6/28/25 8:50 PM, Andy Valencia wrote: > On Saturday, 28 June 2025 at 10:41:47 UTC, Nick Treleaven wrote: > >> static if (is(D Bases == super)) > > Wow. I can't find that in _any_ of my references on D... Not this time. I have it here: https://ddili.org/ders/d.en/is_expr.html Search fo

Re: tupleof of class instance... but enumerate _all_ the instance variables

2025-06-28 Thread Andy Valencia via Digitalmars-d-learn
On Saturday, 28 June 2025 at 10:41:47 UTC, Nick Treleaven wrote: static if (is(D Bases == super)) Wow. I can't find that in _any_ of my references on D... including the language spec itself. Nor in Phobos source... what is a "D Bases", please? Uncle! Andy

Re: tupleof of class instance... but enumerate _all_ the instance variables

2025-06-28 Thread Nick Treleaven via Digitalmars-d-learn
On Friday, 27 June 2025 at 22:33:25 UTC, Andy Valencia wrote: tupleof works for struct and class instances, but explicitly documents that it ignores instance variables from any superclass. Is there any way to enumerate _all_ the instance variables, not just the ones present in the specific in

Re: tupleof of class instance... but enumerate _all_ the instance variables

2025-06-27 Thread monkyyy via Digitalmars-d-learn
On Friday, 27 June 2025 at 22:33:25 UTC, Andy Valencia wrote: tupleof works for struct and class instances, but explicitly documents that it ignores instance variables from any superclass. Is there any way to enumerate _all_ the instance variables, not just the ones present in the specific in

tupleof of class instance... but enumerate _all_ the instance variables

2025-06-27 Thread Andy Valencia via Digitalmars-d-learn
tupleof works for struct and class instances, but explicitly documents that it ignores instance variables from any superclass. Is there any way to enumerate _all_ the instance variables, not just the ones present in the specific instance's class? Thanks, Andy