On Thursday, 23 June 2022 at 21:34:27 UTC, Ola Fosheim Grøstad
wrote:
On Thursday, 23 June 2022 at 21:05:57 UTC, ag0aep6g wrote:
It's a weird rule for sure.
Another slightly annoying thing is that it cares about
destruction order when there are no destructors.
If there are no destructors the lifetime ought to be considered
the same for variables in the same scope.
Having different lifetime rules for different types is worse UX
than having the same lifetime rules for all types.
Imagine writing a generic function which passes all of your unit
tests, and then fails when you try to use it in real code,
because you forgot to test it with a type that has a destructor.