• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

New Mac OS, new programming language: Swift

 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

Here's a short introduction guide to Swift. I haven't looked at it myself yet.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Better link, because that first one was to an iTunes thing which you can only read on an iOS device: The Swift Programming Language

I thought I had read that it was supposed to be replacing Objective-C, but now I can't find it anymore.
 
Sheriff
Posts: 67754
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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".
 
Bear Bibeault
Sheriff
Posts: 67754
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
From today's keynote:

Apple wrote:Swift code can fit along side Objective C and C code in the same application.



That should help ease any migration fears.
 
Bear Bibeault
Sheriff
Posts: 67754
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
More information here, including:

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.

 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic