Tuesday, March 12, 2019

Software-ICs, Binary Compatibility, and Objective-Swift

Marcel Weiher:

Swift recently achieved ABI stability, meaning that we can now ship Swift binaries without having to ship the corresponding Swift libraries. While it’s been a long time coming, it’s also great to have finally reached this point. However, it turns out that this does not mean you can reasonably ship binary Swift frameworks, for reasons described very well by Peter Steinberger of PSPDFKit and the good folks at instabug.

To reach this not-quite-there-yet state took almost 5 years, which is pretty much the total time NeXT shipped their hardware, and it mirrors the state with C++, which is still not generally suitable for binary distribution of libraries. Objective-C didn’t have these problems, and as it turns out this is not a coincidence.

[…]

Swift is designed as a programming language, not as middleware with language features. Therefore its modularity features are an add-on to the language, and try to transport the full richness of that programming model. And Swift’s programming model is very rich.

[…]

Did I mention that Objective-C is middleware with language features?

Previously:

Update (2019-03-13): Peter Steinberger:

Given the above constraints, PSPDFKit will likely never fully move to Swift. First and foremost, we still have many clients with applications built in Objective-C. There’s rarely a good reason to do a rewrite of battle-tested code, and we cannot force our partners to rewrite just for the sake of rewriting. Secondly, moving to Swift would heavily limit our subclassing system — currently, developers can register almost any exposed class and offer a subclass that PSPDFKit will initialize internally in place of our default base class. But seeing as Swift classes can no longer be subclassed in Objective-C, these capabilities would be greatly restricted if we switched to Swift.

This limits us to using Swift internally — which is the worst kind of Swift usage.

1 Comment RSS · Twitter


That is VERY fascinating... and part of the reason why I love Objective-C without fully knowing why.

Leave a Comment