|
|
|
|
|
by Ericson2314
2225 days ago
|
|
> It's not for the actual cleanup of the struct and its children it is for additional cleanup I think that purpose is the tail wagging the dog, an explanation of the current method rather than an actual requirement. The simpler thing to do is just have drop on the aggregate calls drop on the fields, just as new on the aggregate can call new on the fields. |
|
Furthermore, you still have to special-case Drop because now you have to support destructive destructuring for Drop types because it isn't allowed anywhere else.
And plus, if you forget to do this, the failure mode is a stack overflow.
The current design is absolutely based on practical requirements here, it is not a retroactive justification. This is by and large how destructors work, for good reason.