Allow default constructors for structs

monkyyy crazymonkyyy at gmail.com
Fri Aug 30 18:49:04 UTC 2024


On Friday, 30 August 2024 at 16:17:08 UTC, Ogi wrote:
> On Friday, 30 August 2024 at 12:45:27 UTC, monkyyy wrote:
>> but this proposal does not maintain a .init "standard"
>>
>>>>>S v = S.init; // ok (may be a logically incorrect object)
>
> Using `.init` to initialize a struct with a disabled default 
> constructor is [well 
> defined](https://dlang.org/spec/property.html#init-vs-construction) and allowed even in `@safe` code. This proposal doesn’t change anything in this regard.

... no its poorly defined

>  If there is a default constructor for an object, it may 
> produce a different value.

It may not be c's "undefined behavior ^tm" but it is undefined; 
the spec of .init may as well say ".init will exist, and heres a 
bunch of ways its useless"

and my critism is the post above that one


More information about the dip.ideas mailing list