3 ms·
"Interesting, but in most circumstances I think this falls into the "too clever" category. As with most of C++'s weirder features, you really only want to use t
by Animats 11y ago
"Interesting, but in most circumstances I think this falls into the "too clever" category. As with most of C++'s weirder features, you really only want to use them when you absolutely have to."
The C++ committee has been trying to get ownership semantics to work right for about 20 years now. Remember auto_ptr? They've piled hacks on top of of hacks, and it almost works. Almost.
The Rust borrow checker is the right way to do this. Rust has a clear conceptual model of ownership and a way to enforce it. Trying to emulate that via the type system and templates is like pounding a screw. It sort of works, until it doesn't.
Rust doesn't have all the answers, but the ownership model and borrow checking are a huge advance. Any new attempt to solve this problem has to be at least as good.