3 ms·
Oh, the destructive move problem. I thought this was about "re-animation", the horror introduced with Microsoft Managed C++, where, if a GC-called destructor s
by Animats 12y ago
Oh, the destructive move problem. I thought this was about "re-animation", the horror introduced with Microsoft Managed C++, where, if a GC-called destructor saves a pointer to the object being destroyed, the object has to be "re-animated".
No, this is just the destructive move problem for single ownership pointers.
It's an use case for "swap" as a language primitive.
The real problem is that you just can't make single-ownership pointers work right in C++ via the template mechanism. I tried a few times, over a decade ago. (http://animats.com/papers/languages/index.html http://animats.com/papers/languages/index.html) It takes a more global look than you have down inside a template. You need language-level support.
Rust does this. It's not inherently hard. It's just extremely hard to retrofit to the C++ model. Look at the history of auto_ptr, and now unique_ptr in C++. The pain. The anguish. The decades of headaches. The unnecessary complexity. The pain.
- pjmlp 12y agoI got into C++ back in 1993, and it has been one of the main languages on my toolbox. So I do like it quite much. But I am also spoiled by Niklaus Wirth legacy in language design and safe systems programming. As well as ML languages. C++14 feels quite modern, and I enjoy playing with it on hobby projects where I have full control, but I don't miss those C++98 enterprise code bases.