| |
 | Posted by Ola Fosheim Grøstad in reply to Paul Backus | Permalink Reply |
|
Ola Fosheim Grøstad 
Posted in reply to Paul Backus
| On Friday, 24 June 2022 at 03:03:52 UTC, Paul Backus wrote:
> 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.
No, the lifetime is the same if there is no destructor. Being counter intuitive is poor usability.
If you want to help library authors you issue a warning for generic code only.
|