6 ms·
Swift actually has excellent C++ interop [1] (compared to other languages, but, I guess, not good enough for Ladybird). [1] https://www.swift.org/documentation
by lukeh 8mo ago
Swift actually has excellent C++ interop [1] (compared to other languages, but, I guess, not good enough for Ladybird).
[1] https://www.swift.org/documentation/cxx-interop/ https://www.swift.org/documentation/cxx-interop/
- palata 8mo agoI actually looked into that recently (calling C++ from Swift), and I was surprised by the amount of limitations. Said differently: the C++ interop did not support calling the C++ library I wanted to use, so I wrote a C wrapper.
- gmueckl 8mo agoBinding to C++ is an extremely difficult and complex problem for any language that is similarly rich and has lots of (seemingly) equivalent features. The number of subtle incompatibilities and edge cases becomes nearly endless. It's not surprising that some C++ code can't be bound properly.
- palata 8mo agoYeah, that's what I realised. But I just wanted to mention that this is not what I was expecting from "excellent" interop. I would say that C has excellent interop, in general.
- zadikian 8mo agoI did this a long time ago as Swift calling Objective-C++ which can call C++ libs, in that case OpenCV. So it wasn't awful but did require making an ObjC++ wrapper, unless I did something wrong which is also possible.
- palata 8mo agoYes that makes sense. I would just rather make a C wrapper than an ObjC++ one, because then that C wrapper can be used with many other languages.