DIP 1031--Deprecate Brace-Style Struct Initializers--Community Review Round 1 Discussion

Paul Backus snarwin at gmail.com
Sun Feb 16 06:09:08 UTC 2020


On Sunday, 16 February 2020 at 05:57:22 UTC, Walter Bright wrote:
> Left unsaid in all this is the static initializer syntax can 
> only be use for statics, and even then only for structs without 
> a constructor.

It actually works for dynamic initialization too:

> The static initializer syntax can also be used to initialize 
> non-static variables. The initializer need not be evaluable at 
> compile time.

Source: https://dlang.org/spec/struct.html#dynamic_struct_init


More information about the Digitalmars-d mailing list