3 ms·
> For example '=' doesn't mean assign handle or copy. It by default means move. Some complain about this, but the fact is there's no such thing as a zero-overh
by zozbot234 4y ago
> For example '=' doesn't mean assign handle or copy. It by default means move.
Some complain about this, but the fact is there's no such thing as a zero-overhead "copy" for non-trivial types. C++ started out with = meaning clone the object which was an even bigger footgun, and support for move had to be added after the fact.
- scotty79 4y agoYeah. Making = mean copy is a really bad idea. I very much like the solution in Rust where attempt to move out something that can't be moved out results in automatic copy if the type implements trait Copy. It's very elegant solution for simple, small data types. But it further occludes how meaningfully Rust is different from everything else because thanks to that = sometimes does mean copy.