back to article Swift gets swifter: Apple updates its new programming language

Apple's Swift programming language has been enhanced with new features and an upgraded compiler, in the just-released beta version of Xcode 6.3. Swift was announced at Apple’s WWDC event in June 2014 and version 1.0 was released with Xcode 6.0 (Apple’s IDE for OSX and iOS) in September 2014, with version 1.1 following soon …

  1. Anonymous Coward
    Anonymous Coward

    How about ...

    .... Apple finally just bite the bullet and move to C++ for OS/X system and app programming? C++ might not be the best designed language in the world but compared to Obj-C its a Da Vinci of languages. Plus its a standard on almost all operating systems including Linux and Windows.

    1. Phil Endecott

      Re: How about ...

      Apple wants developer lock-in, not standards.

    2. dogged

      Re: How about ...

      you just made a million fanboys spit expensive coffee.

      You might as well suggest they bin Swift, implement C# (also available on Windows and linux) and see how many of them choke to death.

      1. Anonymous Coward
        Anonymous Coward

        Re: How about ...

        "You might as well suggest they bin Swift, implement C# (also available on Windows and linux) and see how many of them choke to death."

        Heh :) Well for app programming that would be fine, but OS/X implements the Posix C system API so it needs a language thats backwards compatible with C for systems programming. Not sure how that dovetails with Swift but TBH I couldn't really care. Apples dev enviroment has never appealed to me - one look at Obj-C put me off for life.

        1. gnasher729 Silver badge

          Re: How about ...

          If one look at Objective-C put you off for life, that's just less competition for everyone else. You've been missing out on a very nice language.

          And Swift has no problems at all calling any C APIs.

          1. dogged

            Re: How about ...

            > You've been missing out on a very nice language.

            Exactly how much of the Kool-Aid did you drink?

            1. Handy Plough

              Re: How about ...

              Judging by your comments, less than you.

            2. SuccessCase

              Re: How about ...

              @dogged. Slagging off mature and capable languages is a child's game. Plus, of course, any language is just a tool, and if Turing complete and moderately efficient, can be used to build pretty much anything. The end user neither knows nor cares which language was used, so language choice is usually far less important than geeks like to think.

              Objective C is quirky, I'll grant you that, but there are two well known sayings about development that illustrate the nature of the problem to be addressed:

              1) software engineering is a constant struggle against naming

              2) premature optimisation is the root of all evil

              The first objective C addresses head on, with long descriptive selectors. In this age of auto-complete gone are the days of short cryptic names; and good riddance too.

              The second objective-C addresses orthogonally (as indeed do all languages) by being now (through maturity and due to recent language additions) an excellent prototyping language. Loosely typed with dynamic selectors extensible at runtime, but where low level c is available if needed/warranted in a tight loop when it is time to optimise. Very very efficient for embedded devices due to the excellent use of ARC, it's evolved into being something slightly odd but remarkably effective and efficient for programming a mobile devices. More efficient than garbage collected languages or languages that compile to a CIL (though this last distinction becomes less and less significant and can bring other advantages). Structurally, in purist terms, odd and disjointed, but practically and pragmatically very mature and practical; quite possibly judged by most who use it and other languages, better than anything else out there for getting the job done (including SWIFT until it has more time to mature).

              1. Anonymous Coward
                Anonymous Coward

                Re: How about ...

                "and if Turing complete and moderately efficient, can be used to build pretty much anything"

                So what? Line BASIC is turing complete and if compiled pretty damn fast. I can't see many people still wanting to use it however.

                "In this age of auto-complete gone are the days of short cryptic names; and good riddance too."

                Nonsense. Names that are too long such as myLongMethodNameThatHasTwoLinesOfCodeAndDoesBuggerAll() inhibit the ability to read the code, not increase it. Names should be descriptive but not to the point where they're almost shakesperian. Perhaps you're one of these people who think code should be self commenting and comments are for idiots?

                "an excellent prototyping language. Loosely typed with "

                Sorry, loose/weak typing is for scripting languages and amateurs, not a serious systems development language. Serious code requires a statically types language because the importance of avoiding runtime bugs overrides you having a slightly easier life when coding it.

                1. SuccessCase

                  Re: How about ...

                  Ha, myLongMethodNameThatHasTwoLinesOfCodeAndDoesBuggerAll()

                  The extent of contrivance you have had to go to to come up with such a bad example, is laughable and actually yes, using selectors like:

                  - (void)updateGridViewCellAtCoordinates:(Coords)coords withStatus:(Status)currentStatus

                  is reasonably self documenting so what on earth is wrong with that? You're so narrow minded you seem to think Objective C developers suddenly lose the ability to think "maybe adding some more comments here will help more" Or perhaps you think the same opportunities for considering how much commenting is useful as any programmer anywhere has simply don't exist for Objective C developers?

                  "Sorry, loose/weak typing is for scripting languages and amateurs" - and that statement sweeps in all those C "amateurs" programming OS kernel code then.

                  It rather seems you think there is a disruption in the space time continuum where "not my programming language" is on the cosmic hell side of the rift, and "my programming language" is on the side of sun and butterflies. Personally I think we live in a fairly normal world.

                  1. Anonymous Coward
                    Anonymous Coward

                    Re: How about ...

                    ""Sorry, loose/weak typing is for scripting languages and amateurs" - and that statement sweeps in all those C "amateurs" programming OS kernel code then."

                    Really? Apparently you don't know the difference between strong/static typing and casting which frankly comes as no surprise to me. Perhaps you should refrain from commenting further until you've taken a refresher course.

                    1. SuccessCase

                      Re: How about ...

                      @boltar

                      So your thought process was "damn, C is weakly typed and that's a what those grown up people use. He's got me there, I know I'll pretend his commenting on my basically wrong statement and not explicitly stating why it is so wrong, means he is presenting it as correct and therefore he is saying C is a dynamic like a scripting language just so I can throw a brickbat and an insult, because after all I am basically a bell-end."

                      1. Anonymous Coward
                        Anonymous Coward

                        Re: How about ...

                        @SuccessCase - Ironic name really

                        So you think C is weakly typed do you? Why not run along and try and add say an int to a struct then and see what happens.

                        If you really want to argue the toss about this I suggest you join a long line of people stretching back 40 years on this topic instead of assuming anyone who doesn't agree with you is a "bell-end". Also do yourself a favour and grow up.

                        1. SuccessCase

                          Re: How about ...

                          "Why not run along and try and add say an int to a struct then and see what happens."

                          Sheesh, exactly the same as will happen in OBJECTIVE C dumbass, y'know that pure superset of C, in which you use C ints and structs all the time and where your objects are dereferenced using pure C pointers and that you were just criticising for being weakly typed.

            3. gnasher729 Silver badge

              Re: How about ...

              Another faith based comment. Surely anything positive said about anything Apple made must be caused by drinking "Kool-Aid" in your weird world.

              Which is totally idiotic, since anyone drinking "Kool-Aid" is not capable of posting anything anymore, you moron. If you try to insult me, put at least a bit of thought into it.

              Apart from that, the Swift Programming Language manual is a free download, and being designed by the brains behind LLVM, who knows more about C++ and other programming languages than I do, and ten times more than you, there couldn't be any doubt that it would turn out rather well.

              And the guy who posted "Names that are too long such as myLongMethodNameThatHasTwoLinesOfCodeAndDoesBuggerAll() inhibit the ability to read the code, not increase it." frankly has never looked at Objective-C.

          2. Andrew Moore

            Re: How about ...

            the fact it has to rewrite every programming convention makes it a bad language- YES/NO instead of TRUE/FALSE? 'self' instead of 'this'? Expecting RGB values as floats rather than hex? There are many others...

            1. SuccessCase

              Re: How about ...

              "Expecting RGB values as floats rather than hex"

              Criticism is fine. Criticism from ignorance is not.

              Tell me which CIE calibrated colour value is #ff292728 ?

              That's why iOS and MacOS use floats and not absolute natural numbers. The system has been design to ensure firstly the specification of common calibrated colour values.

              1. Anonymous Coward
                Anonymous Coward

                Re: How about ...

                "That's why iOS and MacOS use floats and not absolute natural numbers. The system has been design to ensure firstly the specification of common calibrated colour values."

                Except the IEEE 745 standard for flaoting point numbers has a couple of serious drawbacks. Specifically it cannot be guaranteed that equality comparisons between the same apparent values will always work nor that performing an operation and then its reverse will return the start value. Which is kind of a problem when dealing with colours and accuracy is required. Oh, and they're somewhat slower to process than integers.

                1. SuccessCase

                  Re: How about ...

                  "Specifically it cannot be guaranteed that equality comparisons between the same apparent values will always work"

                  Yes you can if you use the same normalisation scheme before comparison. You do normalise your floats before comparison don't you? When dealing with colour of course, the loss of precision normalising floating point values (e.g. doubles in this case) is no problem whatsoever as as the imprecision of any output device you care to mention will be several orders of magnitude less than the the precision of a double (unless you are using scientific spectrogrophic equipment, but then you would be writing your own high precision software to run it). As for the reversibility of operations using floats, yes that can be a problem,... if you're the kind of dumb-arse who treats his views/display-output devices like they are the input source for the data-model data you are using for tracking app state.

              2. Andrew Moore

                Re: How about ...

                That's fine if you need to work with CIE calibrated values- which 99% of us do not. And it is criticism without ignorance. If floats are so important, support them AND hex.

        2. irksum

          Re: How about ...

          Apple's dev environment doesn't appeal to me either, especially when I tried to create a Swift project using XCode and hit a brick wall before even completing creation of the project.

    3. gnasher729 Silver badge

      Re: How about ...

      You could use C++ for MacOS X programming for many, many years. However, C++ has some bad advantages. The worst case is when people with just enough knowledge to be dangerous use it to produce write-only code.

      Swift is a very clean and very safe language in comparison both to Objective-C and to C++. No uninitialised variables, no null pointers, no overflows (and that's just the start).

  2. ratfox

    Growth from zero is always fast

    Swift still ranks lower than the likes of Go and Haskell.

    1. Anonymous Coward
      Anonymous Coward

      Re: Growth from zero is always fast

      A note from the linked article: "Swift’s growth is more obvious on StackOverflow than GitHub"

      In other words, more people are confused by it than writing working code! :-)

    2. thames

      Re: Growth from zero is always fast

      Seeing as Clojure and Groovy are tied for position 19, breaking into the top 20 won't exactly be a high bar to cross. However, since it is intended to replace Objective C and it has only recently really become a stable target, then I won't be all that surprised to see it eventually replace Objective C's position as #10 in Redmonk's rankings.

      Another commonly cited ranking system is Tiobe's, which puts Swift at position 27, which is not that far off Redmonk's 22. However, Tiobe gives a number in terms of percentage of "mind share" (sort of like the equivalent of market share), and getting a 27th most popular ranking only equates to 0.723% of the market.Anything less than 19 comes in as under 1% of the programming "market", and anything less than #9 is less than 2%. Once you get outside of the top dozen languages, you are very much outside of the computing mainstream.

      Redmonk uses a combination of counting Stackexchange posts and Github projects. If you look closely at their chart, it shows that quite a few languages deviate significantly from the median line. What this means is that number of questions on Stackexchange does not necessarily equate to lines of code in Github. In other words, the people using Stackexchange are not necessarily representative of the people actually writing code. That in turn means that we shouldn't take Redmonk's ranking too seriously other than as a rough indicator that yes, the languages which we've all heard of are probably the most widely used. That's not exactly a deep insight though.

  3. Anonymous Coward
    Anonymous Coward

    depends how you read it

    "...Given this dramatic ascension, it seems reasonable to expect that the Q3 rankings this year will see Swift as a Top 20 language.”

    But forward a month or two after that and it could be like Noel Edmonds delivering the terminal news to an under performing 80s band on Top of the Pops. (cue music Da-na-na-na-nah na-na-nah na-na-nah....)

    "This week 'Swift' by Apple is down from No. 19 to No. 39. Coming in at No. 38 - 'Something Obscure' by Scientists. "

    As Bill Hicks said of the Iraqi army, "After the first three largest armies there's a really big ... drop-off "

  4. FlossyThePig

    Which is best?

    I've been in the business an awfully long time now and came to the conclusion years ago. The best language is one that you know well and does the job.

    I first came across ObjectiveC in the mid '90s as it was the best at the time for developing cross platform software (Win3/95, NT, OS/2, Apple, Solaris and other Unix variations). A pain to test and the development team churned out software at a phenominal rate.

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon

Other stories you might like