no-arg constructor for structs (again)
monarch_dodra
monarchdodra at gmail.com
Thu Sep 20 02:27:37 PDT 2012
On Thursday, 20 September 2012 at 09:22:39 UTC, David wrote:
> The only thing I really miss is:
>
>
> class Foo {}
>
> struct Bar {
> Foo foo = new Foo();
> }
>
> void main() {
> Bar s = Bar();
> assert(s.foo !is null);
> }
That probably won't _ever_ work, because that is a default
*instruction*, not a default *value*.
It is a default constructor in disguise :D which is a no-no, as
it would break all of D's move semantics (which are pretty
awesome, IMO).
More information about the Digitalmars-d
mailing list