Disallowing S() when struct S has a constructor

Steven Schveighoffer schveiguy at gmail.com
Fri Aug 30 15:17:06 UTC 2024


On Thursday, 29 August 2024 at 16:44:46 UTC, Nick Treleaven wrote:

> Should we make S() for any struct an error in the next edition?

I have a bold suggestion instead -- let's just start having 
default constructors.

What's stopping us? We are on the cusp of ridding ourselves of 
magic runtime hooks, they are all now becoming templates.

For instance, setting the length of an array now calls a template 
and that template could just call the default constructor if it 
exists.

Then this whole mess of what S() means vs S.init, or whatnot 
becomes much more sane.

It's something we should start thinking about and discussing.

-Steve


More information about the Digitalmars-d mailing list