Default initialization no longer a thing

Paul Backus snarwin at gmail.com
Mon Oct 23 22:45:29 UTC 2023


On Monday, 23 October 2023 at 18:54:45 UTC, IGotD- wrote:
> What is your take on this and if D would ever be modernized, is 
> this something that D should consider?

Most of the time, default initialization is what you want, and it 
doesn't cause any problems. So I think having default 
initialization by default but allowing the programmer to opt out 
is probably the right way to handle this.

Currently, D allows you to `@disable this()` for user-defined 
types, but it doesn't give you any way to opt out of `T.init`. 
This is something that should be improved. If disabling `T.init` 
entirely is too disruptive, there should at least be a way to 
make `T.init` accessible only in `@system` code.


More information about the Digitalmars-d mailing list