Stories
Slash Boxes
Comments

SoylentNews is people

posted by martyb on Tuesday June 03 2014, @04:54PM   Printer-friendly
from the swift-language-but-not-so-swift-name dept.

Apple surprised the audience at its Worldwide Developers Conference in San Francisco on Monday with a tool that few attendees expected: a new programming language for iOS and OS X development called Swift (https://developer.apple.com/swift/). There already is a programming language called Swift (http://swift-lang.org/main/) that was developed by the National Science Foundation, some other government agencies, and the University of Chicago for use in parallel computing applications. This isn't that. What it is, is an entirely new syntax that -- in the words of Apple senior VP Craig Federighi, who unveiled it during the Monday morning WWDC keynote -- aims to be "Objective-C without the baggage of C."

Some of that "baggage" will already be familiar to developers who cut their teeth on C but later moved on to scripting languages such as Python (and Federighi compared Swift to Python several times during his presentation). Like scripting languages but unlike C, Swift lets you get straight to the point. The single line println("Hello, world") is a complete program in Swift. Note, also, that you don't even have to end the statement with a semicolon, as you do in C. Those are optional, unless you're combining multiple statements on a single line; i.e. a semi-colon is a statement separator rather than a statement terminator.

In addition to its online documentation, Apple has released an e-book, The Swift Programming Language, that's a free download (https://itunes.apple.com/us/book/the-swift-programming-language/id881256329) from the iBooks Store. To start working with the language itself, you'll need to download the beta release of XCode 6 (https://developer.apple.com/xcode/downloads/), which includes tutorials to get you going.

 
This discussion has been archived. No new comments can be posted.
Display Options Threshold/Breakthrough Mark All as Read Mark All as Unread
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
  • (Score: 3, Interesting) by VLM on Tuesday June 03 2014, @05:48PM

    by VLM (445) on Tuesday June 03 2014, @05:48PM (#50709)

    "Swift is the result of the latest research on programming languages"

    ... as of 1985 ...

    Now that I've already made the statement, may as well try to verify its truth, does it have anything more modern / exciting than duck typing and no semicolons?

    It might be a good language, but if you PR me into "innovative" and "new" with something from the 80s I'll feel worse than if they just dumped it and asked "take a look".

    Given the PR I expected something like they're going to include lighttable and clojure in every osx install or something. Then I eagerly read on and find... the preprocessor inserts implicit semicolons.... oh thats a "Turing Award" winning innovation right there, for sure, LOL.

    Starting Score:    1  point
    Moderation   +1  
       Interesting=1, Total=1
    Extra 'Interesting' Modifier   0  
    Karma-Bonus Modifier   +1  

    Total Score:   3  
  • (Score: 5, Insightful) by TheRaven on Tuesday June 03 2014, @07:41PM

    by TheRaven (270) on Tuesday June 03 2014, @07:41PM (#50754) Journal

    There's not much novel in Swift, but it does look like the language you get when you look at a lot of existing language and cherry-pick the nice bits. The big omission is concurrency support (no message passing / channels). Don't forget that the main goal of Swift is binary compatibility with Objective-C: it is intended to let developers move to a language where it's easy to migrate to an environment that allows more interesting things.

    I'm generally pretty critical of Apple, but Swift is the first 'new' programming language I've seen in a long time and not said 'WTF?' to. It's not especially novel, but it is an example of what Apple used to be well-known for: taking existing ideas, polishing the hell out of them, and coming up with a clean and easy to use product.

    --
    sudo mod me up
  • (Score: 2) by BasilBrush on Tuesday June 03 2014, @08:57PM

    by BasilBrush (3994) on Tuesday June 03 2014, @08:57PM (#50786)

    Who said it uses duck typing? It's a type-safe language.

    If you read the book, you'll find lots of new stuff.

    One fantastic improvement over C is conditional values. When you declare a value of any type (not just what would be a pointer in C) you can make it conditional. This means that as well as all the normal values of that type, it can have no value (nil). If it's not conditional, it can't have the nil value.

    This means that it is a definite fact both to the programmer and the compiler whether a particular value can have a nil value that must be considered. No need to guess, or check just in case as in C.

    Furthermore, once you check that a value is not nil, you get an "unwrapped version" of that value which is not conditional, so you know that you don't again need to check it for nil.

    And yes, it has a lighttable like IDE. No idea why you mentioned the completely different and obscure language of Clojure though.

    --
    Hurrah! Quoting works now!
    • (Score: 0) by Anonymous Coward on Thursday June 05 2014, @12:35PM

      by Anonymous Coward on Thursday June 05 2014, @12:35PM (#51631)

      One fantastic improvement over C is conditional values.

      That's also not a terribly new concept. Yes, it's not there in C (not directly, at least; you can easily emulate it using a pointer, which given the low-level-nature of C is the right choice). But it has been in several functional languages for many years, has been implemented in Boost for quite some time (boost::optional), and is considered for inclusion in the next C++ standard.

  • (Score: 0) by Anonymous Coward on Wednesday June 04 2014, @02:55AM

    by Anonymous Coward on Wednesday June 04 2014, @02:55AM (#50875)

    Eighties? Try the sixties. John McCarthy's original Lisp already had duck typing and neither did its syntax have semicolons. It also had garbage collection, first class functions, metaprogramming with a flexibility that no language outside of the Lisp family can even touch, and many other features that are only now becoming mainstream. I wonder what features the next big fad language is going to steal from Lisp. First-class ontinuations? Nah.