Objective-C is not a brilliant language and it's finally being discarded by Apple and replaced with something better. This is hard to accept for the (surprisingly) many fans that it has, but Objective-C is almost legacy - jobs, docs, APIs will be Swift-first.
Talking about performance and dynamic typing and message passing won't change that.
Apple looked at the competition and saw that Java 6(!!) was kicking Objective-C's ass - it was easier to program in, less error-prone, easier to understand and fast enough.
Re:Performance These Days
by jrochkind1 on Friday April 22, 2016 @12:09AM
(#11547014)
> If I had to speculate, I'd say the success of many of Apple's UI were due to the SmallTalk aspects of Objective-C
Well, Apple got ObjC and the first version of OSX from NeXTStep and NeXT technology, and that was definitely always NeXT's claim, that they created the right language and the right OS and the right hardware for good UI, from the ground up.
Consider that Obj-C survived transitions from desktop to mobile apps, and many of the features such as modern email viewers with embedded image viewing were accomplished on NeXT long before Windows had comparable features. I think Steve Jobs realized this which was his particular genius -- choosing the right tech and focusing it with a "marketing" angle [8]. I think the newer shift toward Swift at Apple shows a focus on "systems" type of thinking, but unfortunately I've also notice a certain decline in application quality -- i.e. Safari search bar crashing on OS X and iOS [2].
If I had to speculate, I'd say the success of many of Apple's UI were due to the SmallTalk aspects of Objective-C which focused on message passing instead of eager function binding and C++ style inheritance. Having written my own low level object system in C and LLVM for an XML processing language, my take is that while having similar intent to implement dynamic dispatching, the emphasis shift between message-passing vs virtual-tables forces a slightly different style of library and framework composition. Essentially message passing is more expressive but sacrifices potential speed, but as Wikipedia describes it:
> Because a type can have a chain of base types, this look-up can be expensive. A naive implementation of Smalltalk's mechanism would seem to have a significantly higher overhead than that of C++ and this overhead would be incurred for each and every message that an object receives. Real Smalltalk implementations often use a technique known as inline caching[3] that makes method dispatch very fast. Inline caching basically stores the previous destination method address and object class of the call site (or multiple pairs for multi-way caching). The cached method is initialized with the most common target method (or just the cache miss handler), based on the method selector. -- https://en.wikipedia.org/wiki/Dynamic_dispatch
However, practically speaking cache inlining can allow the language implementation to be more expressive and forgiving -- a failed method lookup can be forwarded to an "unknown handler" method as in Ruby's `method_missing` unlike in C++ [3], or the situation in Swift (?) [4].
Basically, Haskell et al have made tremendous strides in progressing type theory and corresponding practical implementation of functional style programming with monadic theory and similar, we're still not sophisticated enough to basically provide easily expressive statically type code which still gives the full expressiveness of dynamic languages. Humans are _really_ good at reasoning about systems of communicating components (message passing, overlapping the actor models of computation) but really not as good at category theory, which while mathematically equivalent don't necessary make them as good for programming large, untyped information that's present in most modern GUI's. Thing's like React however make a huge stride forward in some aspects in that regard. Though I'd rather program that in JavaScript (another prototype based language borrowing from the message passing tradition) than in Swift/C++ style languages which essentially force type checking at a lower level while more complex higher abstractions remain un-type checked. So all the work of the type system while not getting benefit for higher abstractions (e.g. User clicks button which sets system into X state). I'm branching out quite a bit, but it's actually quite a complex problem and is still very much an "open problem", although one we're getting closer to solving well. For clearer examples of what I'm talking about see some of these type of papers I found with a quick search: [5], [6]. My take is that the author is talking about a language more oriented toward system-architecting, an example approach like that taken by Ceylon [7].
[1]: http://arstechnica.com/apple/2005/12/2221/ [2]: http://www.bbc.com/news/technology-35420573 [3]: https://rosettacode.org/wiki/Respond_to_an_unknown_method_ca... [4]: https://github.com/rodionovd/SWRoute/wiki/Function-hooking-i... [5]: https://pdfs.semanticscholar.org/8a42/9baf82c17a936801de4e37... [6]: http://lambda-the-ultimate.org/node/5329 [7]: http://ceylon-lang.org [8]: http://www.infoq.com/news/2011/10/steve-jobs-contribution