3 ms·
I was expecting this pedantic comment... If refcounting makes a language "managed", then C++ with shared_ptr is also "managed". _______ The charitable interpr
by meindnoch 3y ago
I was expecting this pedantic comment... If refcounting makes a language "managed", then C++ with shared_ptr is also "managed".
_______
The charitable interpretation is that OP was likely referring to the issues when calling into a language with a relocating GC (because you need to tell the GC not to move objects while you're working with them), which Swift is not.
- neonsunset 3y agoSwift has just as much concerns for its structs and classes passing across FFI in terms of marshalling/unmarshalling and ensuring the ARC-unaware code performs either manual retain/release calls or adapts them to whatever other mechanism of memory management of the callee. One of the comments here mentions that Swift has its own stable ABI, which exposes richer type system, so it does stand out in terms of interop (.NET 9 will add support for it natively (library evolution ABI) without having to go through C calls or C "glue" code on iOS and macOS, maybe the first non-Swift/ObjC platform to do so?). Object pinning in .NET is only a part of equation and at this point far from the biggest concern (it just works, like it did 15 years ago, maybe it's a matter of fuss elsewhere?).
- pjmlp 3y agoNope, because that is a library class without any language support. The pedantic comment is a synonymous with proper education instead of street urban myths.
- meindnoch 3y agoIt is a library class, because C++ is a rich enough language to implement automatic refcounting as a library class, by hooking into the appropriate lifecycle methods (copy ctor, dtor).