Disallowing S() when struct S has a constructor

Imperatorn johan_forsberg_86 at hotmail.com
Wed Sep 18 09:53:23 UTC 2024


On Friday, 30 August 2024 at 15:17:06 UTC, Steven Schveighoffer 
wrote:
> 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

+1 for default constructor


More information about the Digitalmars-d mailing list