4 ms·
> The libraries being coded in C++ today will never be callable from Rust. This is not true. The FFI story for Rust <=> C++ [1]is good enough that people are e
by nindalf 6y ago
> The libraries being coded in C++ today will never be callable from Rust.
This is not true. The FFI story for Rust <=> C++ [1]is good enough that people are experimenting with it. Where I work at, most internal infra client libraries are written in C++ and now they're all available in Rust.
Your prediction that Rust and C++ will coexist for decades is almost certainly true. But I foresee that they'll coexist in many of those codebases. Code that operates on untrusted input will be written in Rust for security reasons while the rest of it is in C++ or Rust. That's the approach that Chronium [2] is experimenting with.
[1] - https://github.com/dtolnay/cxx/ https://github.com/dtolnay/cxx/
[2] - https://chromium-review.googlesource.com/q/project:experimental/chromium/src+branch:refs/wip/rust-experimental-branch https://chromium-review.googlesource.com/q/project:experimen...
- ncmncm 6y agoIt is absolutely true. The language features that make C++ libraries powerful are wholly inaccessible from Rust, and will remain so. Rust will only ever be able to use parts of C++ libraries specifically cut down or bowdlerized for access by foreign languages. Much of the power of C++ libraries is in their ability to direct the compiler's treatment of the calling code. You cannot write an equivalent of std::tie in Rust, or call it.