Can now use alias for collapsing multiple fields in nested structs

Walter Bright newshound2 at digitalmars.com
Thu Jan 2 08:16:53 UTC 2025


On 12/30/2024 4:08 AM, ryuukk_ wrote:
> ```D
> struct Tada {
>      struct {
>          int a;
>          int b;
>      } data;
> };
> 
> 
> Tada tada;
> tada.data.a = 42;
> ```
> 
> but D can't do that

That's deliberate, not a shortcoming.

There's no purpose to writing declarations that way, unless you're using C.



More information about the Digitalmars-d mailing list