I just read that Apple announced a new version of OS X today and other things, and one remarkable new thing for programmers: the Swift programming language, which is supposed to replace Objective-C.
I haven't looked at it yet. My initial reaction is mixed:
One one hand - why another new language instead of using one of the many existing programming languages? There are already so many programming languages, and especially the last few years it seems like everybody is inventing a new language. Google already has a few, for example Dart and Go, and on the JVM there are also lots of new languages. Why not use one of the existing languages, preferably a modern and popular language? Now everybody who wants to program something for OS X needs to learn a new language, and Apple also give themselves a lot of work because they will need to maintain the new language and develop all the tools for it.
On the other hand - Objective-C is quite old and, although I don't have much experience with it, it looks very ugly to me. It's a strange mix of C and Smalltalk syntax, two syntaxes which are totally different but nevertheless put into one language. It was really time to replace it with something more modern, and hopefully Swift is better suited for today's programming challenges such as multi-core programming.
My understanding is that the backend of the language is the same as they use for Objective-C. So in terms of tools they need XCode integration, but then only compilation to the intermediate representation used by their LLVM tool chain. From that point on, everything works the same as for other LLVM-based language implementations, so there's little to be done in that respect - no new code generator, no new optimizer, no new linker etc.
I haven't seen anything to suggest that Objective-C is being dropped, or relegated to 2nd tier status, and I doubt that will happen for a long time. Apple has in the past maintained complete parallel languages supporting the entire API for many years (Pascal and C in the first decade of the Mac), so they have experience in how to make that happen.
Jesper de Jong wrote:Now everybody who wants to program something for OS X needs to learn a new language...
I haven't read or seen anything about this, but isn't that already the case? I mean, who other than iOS and OS X developers know Objective-C? It was a niche and dying language before OS X and, more significantly iOS, brought it back to life.
One of the main reasons I've not done any OS X or iOS programming -- despite them being my main computing platforms -- is precisely because I don't want to take the time to learn Objective-C.
Switching to a different, little-known language would have the most effect on those who already went through the pain of learning Objective-C in order to write for the Apple platforms. Or not. As Ulf pointed out -- even if "Swift" turns out to be the new hotness, Objective-C is unlikely to get pushed out the airlock anytime soon.
P.S. Sometimes I hate autocorrect: it always wants to change "Ulf" to "elf".
Apple wrote:Swift is the result of the latest research on programming languages, combined with decades of experience building Apple platforms. Named parameters brought forward from Objective-C are expressed in a clean syntax that makes APIs in Swift even easier to read and maintain. Inferred types make code cleaner and less prone to mistakes, while modules eliminate headers and provide namespaces. Memory is managed automatically, and you don’t even need to type semi-colons.
Swift is bringing to iOS and OSX engineers what Groovy brought to Java engineers. An easier language to do the same darn thing. Which, in my opinion, is awesome. Looking at some of the examples, it seems less verbose than Obj-C. Allowing Swift and Obj-C code to run side by side was smart on Apple's part (one of their few smart decisions since we lost Steve). I didn't find Obj-C to be that difficult to pick up. But Swift will definitely open the doors to more developers.