5 ms·
Almost no new projects within Apple are written using Objective-C, and old code is actively rewritten for many reasons, with security being a large one.
by catiopatio 3y ago
Almost no new projects within Apple are written using Objective-C, and old code is actively rewritten for many reasons, with security being a large one.
- lapcat 3y agoCitation needed. I've already provided a citation: https://blog.timac.org/2022/1005-state-of-swift-and-swiftui-ios16/ https://blog.timac.org/2022/1005-state-of-swift-and-swiftui-...
- catiopatio 3y agoI cannot provide a citation for my evidence. Your citation shows the clear trend, however. Swift usage is only increasing, and Objective-C is discouraged (not deprecated, discouraged) for new projects.
- lapcat 3y agoI find it interesting that Objective-C would need to be discouraged, which suggests that Apple engineers don't independently prefer Swift. ;-)
- catiopatio 3y agoI hope you won’t mind me saying so, but I’m most reminded of NeXT’s reverse-acquisition of Apple. It’s not quite as stark, but the same pattern is emerging — folks that couldn’t or wouldn’t adapt found themselves working on ever-shrinking islands — the blue box, ported userspace libraries, drivers, file systems, etc. I’ve written a lot of C and ObjC over the years, and I get where you’re coming from, but there are good reasons to move past C/ObjC for systems and application programming. Swift has some serious warts and is hardly my favorite language, but it brings a lot to the table relative to ObjC, and there’s still room to resolve many of its issues.
- lapcat 3y ago> I hope you won’t mind me saying so, but I’m most reminded of NeXT’s reverse-acquisition of Apple. > It’s not quite as stark, but the same pattern is emerging — folks that couldn’t or wouldn’t adapt found themselves working on ever-shrinking islands — the blue box, ported userspace libraries, drivers, file systems, etc. This sounds like mainly a "political" consideration. Of course Jobs eventually became CEO and pushed his own agenda on the company (just as Cook and Federighi are now pushing their agenda). It's worth mentioning, though, how Apple promised and indeed was in the process of delivering 64-bit Carbon before it was yoinked back at the last minute! Anyway, I fully realize that I'm effectively unemployable right now in a Swift-oriented world. Thank goodness that I'm self-employed. :-)
- azinman2 3y agoNSArchiver aside, how is obj-c insecure?
- saagarjha 3y agoMany more instances of undefined behavior
- azinman2 3y agoSuch as?
- catiopatio 3y agoDynamic dispatch with heavy reliance on runtime metadata is a huge attack surface in terms of being able to leverage a data bug into full control of execution. Additionally, the language provides very few runtime or static compile-time guarantees relative to Swift. This disparity grows even larger if one leverages C directly — which is both common and often necessary when writing ObjC code.
- azinman2 3y agoCan you give an example exploit that goes from a data bug to full control given dynamic dispatch? Less runtime / static guarantees may mean you pass the wrong class type to a method, but typically all that happens is that that object cannot perform the right selector. I can sort of see this being slightly chained to get some mild exploit, but I’d imagine this is pretty edge condition / rare as it would need to respond to the expected selector in the right way useful for exploit. I’ve written a ton of obj-c and work in it, and almost never need or see the use of C.
- pjmlp 3y agoThe C part of Objective-C.
- azinman2 3y agoBut when coding objc you don’t use the C part.
- saagarjha 3y agoThat’s definitely not true. Swift is being used in some new projects but there is still new code being written in Objective-C.
- catiopatio 3y agoI said almost no new projects. It is highly discouraged.
- pjmlp 3y agoMostly true, except for Metal.