Please support shorter constructor init

IchorDev zxinsworld at gmail.com
Sun Jul 9 17:32:20 UTC 2023


On Saturday, 8 July 2023 at 19:41:39 UTC, Nick Treleaven wrote:
> ...
>> And if they don't map one on one, the caller can use a static 
>> or dynamic initializer instead:
>> ```d
>>     Rectangle r2 = {width:6, height:7, x:4, y:5};
>>     writeln(r2); // Rectangle(4, 5, 6, 7, Blue)
>> ```
>
> That doesn't allow fields to be dynamically initialized 
> automatically, like constructors do.
>

https://dlang.org/spec/struct.html#dynamic_struct_init
Is this not... "automatic"?


More information about the Digitalmars-d mailing list