Structs are Not Plain: A call for empty struct constructors

Max Samukha maxsamukha at
Fri Sep 20 04:42:51 UTC 2019

On Thursday, 19 September 2019 at 20:25:53 UTC, Jonathan M Davis 
It has to do
> with how D was designed with the idea that every type has an 
> init value which is known at compile time, and various 
> operations rely on being able to simply blit that init value.

We understand the rationale behind the design. The point is that 
the idea has never worked. If you define a destructor, you most 
certainly want the object to be non-trivially initialized at run 
time. New instances of
that type, even "branded" with .init, are NOT initialized - they 
are in an invalid state. That is why almost every D struct with a 
destructor is compelled to implement those opCall/external 
constructor/lazy initialization hacks.

More information about the Digitalmars-d mailing list