Swift is getting really mature. Stable ABI. Using clang to access and represent C++ types natively. No ffi bindings required. Foundation library available on all desktop platforms.
I hope Rust will start putting some serious effort behind C++ migration/interop. Or I can see a future where the C++ industry migrates largely to Swift, with perhaps Rust libraries for specific tasks like codecs. Which is fine but I worry about some companies, that would be willing to use Rust, never catching up to that.
C++ code will never migrate directly into Safe Rust. Swift found a middle ground for it that Rust will need too. Unsafe Rust needs to become a language people can do their daily work in that is better than C++. That’s what migration can look like.
I was skeptical of Carbon’s plan to build out an unsafe language that is good to work in, since I felt like the safe language is where people should be. I still worry about coming in and building the safe language later, but I can see the value of making an ergonomic unsafe language (nullability for pointers for example), because they are taking seriously the idea of migrating whole C++ codebases to this language. AND understanding that people will be working in that (unsafe) language full time.
An unsafe Rust can still solve a ton of safety problems, leaving lifetimes to mitigations like smart pointers (like raw_ptr in Chrome). This seems like the viable incremental migration/adoption strategy for Safe Rust. Swift is nailing this. I think Carbon is trying to go this direction too.
Anyway, enjoy an interesting chat with the Swift team manager:
Does anyone know how references in Carbon work? All articles I find don’t go in-depth enough to even use references. Do you still have to use auto& to not strip off the reference-ness?