Thread overview
[Issue 24805] The spec should not refer to default initialization as default construction when discussing disabling it
October 11
https://issues.dlang.org/show_bug.cgi?id=24805

Jonathan M Davis <issues.dlang@jmdavisProg.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |spec

--
October 12
https://issues.dlang.org/show_bug.cgi?id=24805

Nick Treleaven <nick@geany.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nick@geany.org

--- Comment #1 from Nick Treleaven <nick@geany.org> ---
> As default construction is not a thing with structs

What about initializing the context pointer?

https://dlang.org/spec/property.html#init-vs-construction

--
October 12
https://issues.dlang.org/show_bug.cgi?id=24805

--- Comment #2 from Jonathan M Davis <issues.dlang@jmdavisProg.com> ---
(In reply to Nick Treleaven from comment #1)
> > As default construction is not a thing with structs
> 
> What about initializing the context pointer?
> 
> https://dlang.org/spec/property.html#init-vs-construction

D structs do not have default construction, and it is always incorrect to refer to anything that happens with them as default construction. They have default initialization, which normally is simply blitting the init value, but with non-static structs that then have a context pointer to their enclosing scope, some additional initialization code is run when they're initialized to also set their context pointer, making it so that there is a difference between that and directly initializing the struct with its init value in those specific cases.

However, there still is no default constructor or default construction, and referring to it that way is just going to confuse people. Default constructors are a C++ thing, and even if we were to add them to D structs at some point, the default initialization that currently occurs would still occur prior to the default constructor being called (since that's required for the type to be in a valid state; it's also what happens with classes), so there would still be a difference between default initialization and default construction.

--
October 13
https://issues.dlang.org/show_bug.cgi?id=24805

--- Comment #3 from Jonathan M Davis <issues.dlang@jmdavisProg.com> ---
I've e-mailed Walter for clarification on this. It appears that the compiler's error messages are in agreement with the terminology used in the spec. So, the current terminology may very well be what Walter wants to use in spite of the fact that we don't have default constructors, and we normally talk about structs being default-initialized rather than default-constructed, because we don't have default constructors, and the mechanics are different.

--
October 14
https://issues.dlang.org/show_bug.cgi?id=24805

--- Comment #4 from Jonathan M Davis <issues.dlang@jmdavisProg.com> ---
Walter agreed to updating the terminology to refer to default initialization instead of default construction. I'll open a separate issue for the compiler messages.

--