<story><title>On Apple&apos;s Love Affair with Swift</title><url>https://stefan-lesser.com/2018/06/20/on-apples-love-affair-with-swift/</url></story><parent_chain><item><author>pavlov</author><text>Chris Lattner writes:&lt;p&gt;&lt;i&gt;”One of the best and most annoying things about Objective-C is that it has C in it. This has been hugely important for Objective-C in practice, because if you run into a performance problem with objc_msgSend, you can always rewrite that algorithm in C. That’s really, really, really important for Objective-C being successful in both in the days of NeXT on 16 MHz processors and also today for the low-level code that people are writing.”&lt;/i&gt;&lt;p&gt;This is indeed a great thing about Objective-C: it’s an improved C with a tight set of runtime features that help build interactive applications.&lt;p&gt;There’s a need for such a language, and I’m sad that so much of the rhetoric from Apple and the Swift community is working on the assumption that Obj-C should be completely replaced by Swift.&lt;p&gt;Swift is not a compact language like Objective-C. It’s more like C++ in how it tries to incorporate every programming paradigm that can possibly fit. The heavy focus on complex upfront typing is not necessarily the best choice for iterative app development.&lt;p&gt;Swift is useful in many places, but personally I found Objective-C’s “Smalltalk-flavored C” to hit a sweet spot for my GUI needs where integrating with C and C++ libraries is usually required all over the place.</text></item></parent_chain><comment><author>pjmlp</author><text>Yeah, but you forgot to copy the other relevant part.&lt;p&gt;&amp;gt; The fundamental problem was Objective-C was built on top of C. C inherently has pointers. It has uninitialized variables. It has array overflows. It has all these problems that even if you have full control of your compiler and tool stack, you just can’t fix. To fix dangling pointers, you would have to fix lifetime issues, and C doesn’t have a framework to reason about that, and retrofitting that into a compatible way into the system just wouldn’t really work.&lt;p&gt;If you took away C from Objective-C, you couldn’t use C arrays on the stack, for example. And if you couldn’t do that, there’s entire classes of applications where the performance just wouldn’t be acceptable. We went around, around, around. We said the only way that this can make sense in terms of the cost of the disruption to the community is if we make it a safe programming language: not “safe” as in “you can have no bugs,” but “safe” in terms of memory safety while also providing high performance and moving the programming model forward.</text></comment>
<story><title>On Apple&apos;s Love Affair with Swift</title><url>https://stefan-lesser.com/2018/06/20/on-apples-love-affair-with-swift/</url></story><parent_chain><item><author>pavlov</author><text>Chris Lattner writes:&lt;p&gt;&lt;i&gt;”One of the best and most annoying things about Objective-C is that it has C in it. This has been hugely important for Objective-C in practice, because if you run into a performance problem with objc_msgSend, you can always rewrite that algorithm in C. That’s really, really, really important for Objective-C being successful in both in the days of NeXT on 16 MHz processors and also today for the low-level code that people are writing.”&lt;/i&gt;&lt;p&gt;This is indeed a great thing about Objective-C: it’s an improved C with a tight set of runtime features that help build interactive applications.&lt;p&gt;There’s a need for such a language, and I’m sad that so much of the rhetoric from Apple and the Swift community is working on the assumption that Obj-C should be completely replaced by Swift.&lt;p&gt;Swift is not a compact language like Objective-C. It’s more like C++ in how it tries to incorporate every programming paradigm that can possibly fit. The heavy focus on complex upfront typing is not necessarily the best choice for iterative app development.&lt;p&gt;Swift is useful in many places, but personally I found Objective-C’s “Smalltalk-flavored C” to hit a sweet spot for my GUI needs where integrating with C and C++ libraries is usually required all over the place.</text></item></parent_chain><comment><author>coldcode</author><text>I have used Objective-C since 1997 when I worked with WebObjects back then and I don&amp;#x27;t miss it for a second. When I have to touch our one codebase with Objective-C I have to groan. It was amazing for its day and I did enjoy it despite its shortcomings. But I can write way more highly functional code faster in Swift than I ever could in Objective-C due to real type safety and other modern features. I also spent years doing regular C and C++ and Java (not at the same time) and all 3 languages seem clunky to me now. Preferring Objective-C over Swift is wishing for the golden oldie days kind of thinking and I&amp;#x27;m one with almost 4 decades of programming experience. Swift is still young and growing and sometimes thats a bit challenging to adapt, but its the one language I truly enjoy now.</text></comment>