Hacker News new | ask | show | jobs
by ssvss 2935 days ago
Is there a plan for c++ Interop in swift. Or have they decided that using the obj-c bridging layer is enough.
2 comments

It's on the list of things that would be nice someday, but it will take a lot of time to get right, and it's not a high enough priority right now. There's a handful of other significant features that will come first, like ABI stability, Ceylon/Rust style ownership checking, first-class concurrency/atomics (async/await, etc.).

That said, Swift's C interop will work if you write an `extern "C"` interface to your C++. Obviously it's not ideal, but people have done projects like llvm-swift[0], with LLVM obviously being a C++ project.

[0]https://github.com/llvm-swift/LLVMSwift

AFAIK it’s still in the cards but it’ll come after ABI stability. I have at least one project that’ll make use of this — can’t wait to drop the ObjC layer in it entirely.