On Friday, 11 April 2014 at 12:26:14 UTC, Steven Schveighoffer wrote:
This is a side effect of classes being first-class reference types. Array needs to call destroy on structs, but not on classes. Sort of a "shallow destroy."

It's an interesting bug.

-Steve

Yeah, the issue "transcends" the language. Things like "FieldTypeTuple" on a class (directly) also tell you what the class is made of.

Ideally, the call should have been "protected" by a "hasElaborateDestructor" to begin with. Not only does it make the code faster for types that don't have destructors, "hasElaborateDestructor" replies false for classes.

User @denis-sh had complained about "destroy" before for this very reason, and had proposed a "destruct":
https://github.com/D-Programming-Language/phobos/pull/929

Reply via email to