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: Is there a way to tell D to rearrange struct members or to not rearrange class members?

2025-06-28 Thread monkyyy via Digitalmars-d-learn
On Saturday, 28 June 2025 at 15:20:44 UTC, WraithGlade wrote: D is a great language and well designed, but as I've been learning it I have noticed that nearly always when there is something I dislike about the language (which is relatively seldom) it is because some form of "best practice" or

Re: Is there a way to tell D to rearrange struct members or to not rearrange class members?

2025-06-28 Thread Lance Bachmeier via Digitalmars-d-learn
On Saturday, 28 June 2025 at 15:20:44 UTC, WraithGlade wrote: There are very few imposed structural "best practices" that are genuinely universal in my experience. Good naming of variables would be a rare example of a universally good practice, in my opinion, but in contrast even pervasive and

Re: Is there a way to tell D to rearrange struct members or to not rearrange class members?

2025-06-28 Thread WraithGlade via Digitalmars-d-learn
On Friday, 27 June 2025 at 20:08:31 UTC, Lance Bachmeier wrote: ... I think you're referring to [this description in the spec](https://dlang.org/spec/class.html#fields): The D compiler is free to rearrange the order of fields in a class to optimally pack them. Consider the fields much like

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: How can I signal a master object that a resource handle is no longer used, from within the resource class's destructor?

2025-06-28 Thread realhet via Digitalmars-d-learn
On Thursday, 26 June 2025 at 16:40:10 UTC, Steven Schveighoffer wrote: On Tuesday, 24 June 2025 at 08:48:16 UTC, realhet wrote: Finalizers are run with the world resumed. I'll remember this. It sounds less mystical than I thought. Currently I'm having an 'infrastructure' that's like: I'm ma