DEV Community


Discussion on: What If Swift Didn't Exist?

eljayadobe profile image

I think if Swift did not exist, Apple would have found or created something else to replace Objective-C.

Objective-C is a hybrid language. Part C, part Objective. Over time, it has been enhanced incrementally. The syntax is awkward. It has a challenging learning curve. There are categories of programming errors that are poorly served by the language.

Apple has looked at several alternatives languages over the years, and tested the waters with them, but had not committed to any of them. Such as Dylan, and MacRuby.

Also, keep in mind, that Apple has made the transition between languages before. At one time, Object Pascal was the anointed language. Then the anointed language became C++, and all the Object Pascal developers were unhappy.

When Apple sold itself to Next, and NextStep became OS X, we got Objective-C along for the ride. But there was a divide... the Carbon and C++ camp, and the Cocoa and Objective-C camp. Eventually, Apple pulled the plug on Carbon. That was a bumpy ride.

Now the same kind of thing is happening for their premier language: emphasizing Swift, and (as I read the tea leaves) deprecating Objective-C. I don't know if Apple has officially called out Objective-C as being "deprecated", but I'm calling it that.

The one thought experiment I have is "If not Swift, what other language would Apple have considered?" Java? C#? D? Go? Scala? Haskell? (Ignoring Dylan and MacRuby.)

I think the reason Apple ultimately decided to charter Chris Lattner to invent Swift was that they had a list of language features that no other language fully satisfied. A critical one being "interop compatible with Objective-C and Cocoa"... that's a bit of a challenge!

I looked at Swift 1.0 as an early (and painful) alpha, Swift 2.0 as a beta, but Swift 3.0 as a good maturing language ready for prime time. Is Swift 3.0 the language that fulfilled all the language features that Apple desired? I don't know, but I reckon that some features got dropped while others were added late in the game.

I like Swift better than Objective-C. But it has quirks, some of which are due to the Cocoa bridging... but all in all, Swift is an amazing feat. On par with transitioning the platform from 68000 to PowerPC, or from PowerPC to Intel.