Struct initialization is a mess

Dukc ajieskola at gmail.com
Thu Jul 29 15:58:34 UTC 2021


On Thursday, 29 July 2021 at 09:02:16 UTC, Walter Bright wrote:
> I also tried to get rid of the brace initialization of structs 
> in favor of the () method, but some people really wanted the 
> braces.

Your named arguments DIP could at a quick glance finally make 
them obsolete...

...however, one problem: `struct`s with `static` `opCall`. If the 
`struct` in question has `const` or `immutable` members, the 
brace syntax is the only good way to initialize them. Without 
them you'd have to resort to ugly and unsafe casts.


More information about the Digitalmars-d mailing list