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

Walter Bright newshound2 at digitalmars.com
Thu Feb 13 21:05:19 UTC 2020


On 2/13/2020 7:49 AM, IGotD- wrote:
> Isn't that a bit restrictive?

Yes, and it's on purpose. Note that this applies to C++ as well.

If all the constructor does is supply its arguments to the fields, there's not 
point in providing one. If it does more than that, by using literals the user 
could bypass that, which would be a clear code smell if not an outright bug. 
Worse, it would be difficult to QA the code as the constructor call would look 
just like an initializer.


More information about the Digitalmars-d mailing list