4 ms·
Fun with lifetime-extended results of assignment
- deleted 4y ago[deleted]
- jbandela1 4y agoIn my experience, relying on lifetime-extension is a code smell. It is subtle and easy to get wrong, and can be brittle in the face of refactoring or code changes. My advice is to rewrite your code to not rely on lifetime extension.
- hobo_mark 4y agoIt's remarkable that this person still blogs under his real name.
- nyanpasu64 4y agoThe ambiguity and implementation divergences caused by implicit behavior is why I'm in favor of linear typing, with explicit function calls to destroy objects, and the compiler verifies you destroy each object exactly once on each execution path (but does not introduce new behavior beyond the source code). Stack unwinding could either be removed, or call the "default destructor" of any objects when a panic occurs in a region of the code where an object is not yet destroyed.