3 ms·
Incremental rewriting introduces the potential for new issues, as foreign function interfaces are inherently unsafe. Rust also has its own costs. Its biggest l
by rbehrends 9y ago
Incremental rewriting introduces the potential for new issues, as foreign function interfaces are inherently unsafe.
Rust also has its own costs. Its biggest limitation when it comes to mixing in code with that written in another language is probably its poor support for shared ownership (i.e. multiple references of the same object), while in most languages, shared ownership is the norm.
Multi-language setups (which you invariably get with an incremental rewrite) also generally create other interfacing issues when they share objects. How are you going to represent `std::shared_ptr<T>` or `std::vector<T>` in Rust, for example? They are opaque types, after all. Can you guarantee that Rust properly observes C++ semantics with regard to assignment, move assignments, and destructors when dealing with instances declared entirely in C++ code once you start mixing and matching C++ and Rust?