Stories
Slash Boxes
Comments

SoylentNews is people

SoylentNews is powered by your submissions, so send in your scoop. Only 17 submissions in the queue.
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: 1, Interesting) by Anonymous Coward on Tuesday June 03 2014, @05:06PM

    by Anonymous Coward on Tuesday June 03 2014, @05:06PM (#50692)

    What advantage are they seeking by getting rid of statement terminators? I like those, they make it clear when a statement is finished.

    Aside from the minor benefit of saving a single character per statement, what is the reason for dropping them?

    Starting Score:    0  points
    Moderation   +1  
       Interesting=1, Total=1
    Extra 'Interesting' Modifier   0  

    Total Score:   1  
  • (Score: 5, Funny) by Tork on Tuesday June 03 2014, @05:23PM

    by Tork (3914) Subscriber Badge on Tuesday June 03 2014, @05:23PM (#50697)
    Look, you may think line terminators are easy to spot now, but you'll be singing a different tune when they stop using rubber skin!
    --
    🏳️‍🌈 Proud Ally 🏳️‍🌈
  • (Score: 2) by c0lo on Tuesday June 03 2014, @05:25PM

    by c0lo (156) Subscriber Badge on Tuesday June 03 2014, @05:25PM (#50698) Journal

    Can't have so small chances for bugs due to a lax syntax [gotofail.com], can we? I mean, without 0-days, how would the NSA take care of US citizens' security?
    (Look at Pascal for example: so strict, hardly a syntax bug can slip past the compiler: how much new software is written in Pascal nowadays?)

    Besides, with the war on drugs and Afghanistan waning, new concepts and fronts need to be open for war.

    --
    https://www.youtube.com/watch?v=aoFiw2jMy-0 https://soylentnews.org/~MichaelDavidCrawford
    • (Score: 3, Funny) by VLM on Tuesday June 03 2014, @05:38PM

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

      "Besides, with the war on drugs and Afghanistan waning, new concepts and fronts need to be open for war."

      There's always the war on freedom. More seriously I wouldn't mind a jihad on mutable objects. Just go functional and be done with it.

    • (Score: 2) by HiThere on Wednesday June 04 2014, @12:10AM

      by HiThere (866) Subscriber Badge on Wednesday June 04 2014, @12:10AM (#50837) Journal

      Pascal doesn't handle utf-8 any better than does C. It's difficult to write parallel programs. Etc.

      OTOH, if Pascal had been reasonably updated I think it would have been an excellent language.

      --
      Javascript is what you use to allow unknown third parties to run software you have no idea about on your computer.
      • (Score: 2) by Aiwendil on Wednesday June 04 2014, @05:58AM

        by Aiwendil (531) on Wednesday June 04 2014, @05:58AM (#50933) Journal

        Did you ever take a look at Objective Pascal/Delphi?

        But yes, Pascal suffers from a delay before features of other languages reach it. (Then again, Ada suffers from that its features doesn't get popular until another language implements it - so being updated/first isn't always a good thing)

        • (Score: 0) by Anonymous Coward on Thursday June 05 2014, @09:34AM

          by Anonymous Coward on Thursday June 05 2014, @09:34AM (#51559)

          Actually the Extended Pascal standard suffered mostly from not being implemented by many compilers. Maybe it was an error to publish it as separate standard instead of as update to the Pascal standard, but then, most Pascal compilers already largely ignored the Pascal standard anyway, and on the other hand, C++ later proved that you can be successful with a new standard based on an existing one.

  • (Score: 3, Informative) by theluggage on Tuesday June 03 2014, @05:46PM

    by theluggage (1797) on Tuesday June 03 2014, @05:46PM (#50708)

    what is the reason for dropping them?

    Uh - my guess at a boring answer? I guess its because Swift source code supports Unicode: e.g. you can have Greek letters as variable names (or emoticons, but then you'd really have to be shot for the good of humanity). That means there is a single formal definition [wikipedia.org] of what characters count as line terminators.

    Just be thankful that's as far as they ventured down the road to hell that is significant whitespace, or we could have had another Python on our hands...

  • (Score: 2) by BasilBrush on Tuesday June 03 2014, @08:39PM

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

    Losing an unnecessary punctuation character makes for cleaner code.

    If you like them, you are in luck because there's nothing stopping you from using them. They are still there, they are just optional unless you want multiple statements per line.

    --
    Hurrah! Quoting works now!
    • (Score: 0) by Anonymous Coward on Tuesday June 03 2014, @09:14PM

      by Anonymous Coward on Tuesday June 03 2014, @09:14PM (#50795)

      Then practice what you preach and stop using periods in your prose After all, as long as there is a capital letter at the beginning of the sentence or a newline, then the end of the sentence is obvious Of course there is still some ambiguity with acronyms and the like, so continue using periods there Of course there is the slight possibility that less punctuation can in some cases make things harder to read but I suppose that's the price of progress

      • (Score: 2, Insightful) by Tramii on Tuesday June 03 2014, @10:18PM

        by Tramii (920) on Tuesday June 03 2014, @10:18PM (#50814)

        Cute, but wrong

        If you wanted your example post to be completely accurate, you would have written your post with hard returns at the end of every sentence

        If you don't add the hard returns, it would still require that you add periods in between sentences

        Frankly, I think would be weird to leave off the semicolons, but I don't foresee any issues with the way Swift implemented it

        • (Score: 0) by Anonymous Coward on Tuesday June 03 2014, @11:03PM

          by Anonymous Coward on Tuesday June 03 2014, @11:03PM (#50827)

          I see :)

          I would note though that GP claimed 'losing an unnecessary punctuation character' made code cleaner; I was trying to argue by example by demonstrating that unnecessary punctuation, like periods, can make prose more readable.

          • (Score: 2, Interesting) by zsau on Wednesday June 04 2014, @11:45PM

            by zsau (2642) on Wednesday June 04 2014, @11:45PM (#51399)

            seeing as there is no convention of interpreting a capital letter as a separator (but there is a convention of interpreting a new line as a separator)

            and seeing as it's increasingly common to see newlines added in english prose even where paragraph boundaries had not been common

            (i've even seen it used in the middle of sentences, e.g. in a transcript of a British minister in a speech about Scottish independence)

            then really, if you're going to say "let's get rid of unnecessary english punctuation", it's capital letters and fullstops you'd be killing, replacing them with newlines boundaries

            both of which are not uncommon anyway: one day, all english prose might look like this

      • (Score: 2) by BasilBrush on Tuesday June 03 2014, @10:19PM

        by BasilBrush (3994) on Tuesday June 03 2014, @10:19PM (#50815)

        Nice try. But you didn't use new lines to separate either, so by analogy with swift you'd need periods in the paragraph you wrote.

        When using English in a form where a newline is a separator, such as a bullet pointed list, or title and subtitle, it is indeed common to not terminate each item with a period.

        --
        Hurrah! Quoting works now!
        • (Score: 0) by Anonymous Coward on Tuesday June 03 2014, @10:59PM

          by Anonymous Coward on Tuesday June 03 2014, @10:59PM (#50826)

          FWIW I use punctuation in lists, eg

          1) Thing a;
          2) Thing b; and,
          3) Thing c.

          • (Score: 2) by BasilBrush on Wednesday June 04 2014, @03:25PM

            by BasilBrush (3994) on Wednesday June 04 2014, @03:25PM (#51135)

            You're doing it wrong.

            But hey, just like English, Swift allows you to put those statement terminators in there if you really want.

            --
            Hurrah! Quoting works now!
      • (Score: 2) by tibman on Tuesday June 03 2014, @10:26PM

        by tibman (134) Subscriber Badge on Tuesday June 03 2014, @10:26PM (#50817)

        Would mod you funny if able : )

        --
        SN won't survive on lurkers alone. Write comments.
    • (Score: 3, Interesting) by forsythe on Tuesday June 03 2014, @10:12PM

      by forsythe (831) on Tuesday June 03 2014, @10:12PM (#50809)

      I'm not really so interested in what I can do with formatting, or how pretty my code looks (within reason). I'll adapt. I'm interested in the wonderful, subtle bugs that other programmers can create, then leave for me to encounter. If optional semicolons leads to rules that require people to write blog posts like this [benalman.com] to illustrate them, that's rather counterproductive to the notion of `cleaner code'.

      Of course, if they're done well, and no unintuitive behavior of any sort arises, then good for Apple. But somehow I doubt that.

      • (Score: 3, Informative) by BasilBrush on Tuesday June 03 2014, @10:28PM

        by BasilBrush (3994) on Tuesday June 03 2014, @10:28PM (#50820)

        I'm not a Javascript user, so I can't comment on semi-colon use there. However I do recall reading that Javascript was originally hacked together in about 4 days by one person. So maybe that explains the lack of rationality there.

        Swift on the other hand has been in development at Apple for 4 years, before any public release, including major use by their developer tools team. If there were ambiguities introduced by optional semicolons I would expect they'd have spotted them by now, and made semicolons mandatory again.

        There's been plenty of other languages that didn't need semi-colon terminators. It's hardly an impossible task.

        --
        Hurrah! Quoting works now!