I don’t disagree, it’d be great to fix! But I think there is a substantial amount of design left to go. Regardless, I think there is still a legitimate reason to stabilize drop order:
- Drops can have other side effects besides using references (i.e., sending messages).
- Even with safe references, you have to drop the references before the thing they refer to, so we would have to specify that (think dropck).
Now, point 2 could be argued as a reason to reverse the existing drop order, in that right now if you had a struct with an arena and a ref into that arena, it would have to look like:
struct Foo {
r: RefIntoArena, // so that this gets dropped before `arena` gets dropped!
arena: Arena,
}
This is why C++ reversed the drop order, and why we initially had it that way. To be perfectly honest, I’m not sure why it was changed.
(Can’t remember; heck I probably approved it) But I kind of feel like it’s not worth the breakage to do anything about it; it’s sort of arbitrary, after all, and dropping in-order is also fairly intuitive.