aspose file tools*
The moose likes Mac OS and the fly likes New Mac OS, new programming language: Swift Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Mac OS
Bookmark "New Mac OS, new programming language: Swift" Watch "New Mac OS, new programming language: Swift" New topic
Author

New Mac OS, new programming language: Swift

Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14432
    
  23

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.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42929
    
  68
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
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14432
    
  23

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.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61766
    
  67

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".


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61766
    
  67

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
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61766
    
  67

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.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15300
    
    6

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.


GenRocket - Experts at Building Test Data
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: New Mac OS, new programming language: Swift