Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Most languages? I only know of two languages with move semantics: C++ and Rust. The latter has the benefit of a clean slate and build upon C++ experience. C++ had to be backward compatible with pre C++11 and couldn't make destructive moves work.


I did not say most languages, I said most languages that have move semantics. Neither C++ or Rust invented the concept which dates back to the 1980s.

>C++ had to be backward compatible with pre C++11 and couldn't make destructive moves work.

This is simply untrue as per the original proposal which left the door open to destructive moves (that door is now closed). There is nothing about destructive moves that make it incompatible with C++98/03. The main concern for destructive moves was how to deal with moves across an inheritance hierarchy, certainly a reasonable concern to have but nothing insurmountable by any means.

The issue is that, as most things involving C++, decisions are pondered upon endlessly by a very small group of people not on the basis of their technical qualifications but on the basis of being able to to participate in the C++ standardization process, which requires physically travelling to numerous locations around the world at ones own expense. If C++ had a more open standardization process that embraced research from other languages and communities, this issue would have been solved.

You can read the original proposal here:

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2002/n137...

Note the section on destructive moves which doesn't mention anything to do with compatibility, and finally note why it wasn't adopted:

"In the end, we simply gave up on this as too much pain for not enough gain."

By "we" the author means three people gave up on it. Three people who couldn't find a solution to a problem (which has a solution) is why C++ is forever stuck without destructive move semantics.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: