http://d.puremagic.com/issues/show_bug.cgi?id=9732
--- Comment #7 from Maxim Fomin <[email protected]> 2013-03-17 09:21:59 PDT --- (In reply to comment #3) > I really don't think that's a problem. If anything, the default value should > NOT be destroyed in the constructor. After all, it hasn't really even been > initialized yet. There are several corner cases when dtor gets default value. By the way, how you can distinguish whether object was recently initialized to its state was reseted? > If anything, that's exactly how "aggregate construction" works: postblit each > value over the current fields, but DON'T destroy the fields: > > //-------- > import std.stdio; > > struct Inner > { > int i; > this(this){} //Postblit implies destruction of this. > ~this() > { > writeln(i); > } > } > > struct Outer > { > Inner inner = Inner(1); // <-- compile-time .init > } > > void main() > { > auto inner = Inner(2); > { > writeln("****"); > auto outer = Outer(inner); // Overwrite with postblit, but don't call > destructor. > writeln("****"); > } > { > writeln("****"); > auto outer = Outer(inner); // Overwrite with postblit, but don't call > destructor. > outer.inner = inner; // Call postblit, destroying previous > state. > writeln("****"); > } > } > //-------- > **** > **** //Notice no destroyer called here > 2 //This is outer's destroyer destroying its inner > **** > 2 //This is our second blit. > **** > 2 //This is out second outer destroyer's destroying its inner > 2 //This is our inner's destroyer > //-------- > > So yeah, my conclusion is: destroyers are not a problem to this proposal. I don't how this is related to the issue. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
