1. 39

Also a splash page: https://developer.apple.com/swift/

  1.  

    1. 6

      From this Reddit post:

      A quick overview:

      • Statically typed with type inference.
      • Generics.
      • Closures.
      • No exceptions.
      • Extension methods.
      • Properties (syntax similar to C#), including lazy properties with the "@lazy" annotation.
      • Functions, methods and type (static) methods.
      • Support for observers (with "willSet" and "didSet"). Interesting to see the observer pattern baked in a language although I’m more partial to event buses for this kind of thing.
      • Enums.
      • Classes and structures (structures have restrictions regarding inheritance and other things).
      • For and while loops (statements, not expressions).
      • "mutating" keyword.
      • Named parameters.
      • Deinitializers (finalizers).
      • Protocols (interfaces).
      • Optional chaining with "a?.b?.c" and forced dereference with "!."“.
      • Convenient “assign and test”: "if let person = findPerson() ...".
      • Type casting with "is", down casting with "as?" (combines nicely with the "let" syntax. Ceylon does it right too).

      Also option types.

      1. 9

        I have to say, I’m a little torn about Swift.

        On one hand, I’m a willing to be pragmatic and realize that this is a step up from Obj-C or just C! On the other, though, I know this doesn’t really take a big step forward, or even really match some of what we’ve already done with ML & co.

        So yay but also meh.

        1. 4

          Very interesting. The main reason I’ve never tried my hand at writing for an apple platform is because objective-c looks no fun. I might finally give it a try once this is fully rolled out.

          1. 4

            I admit to being in the same boat. I skimmed the ebook and the language [swift], on paper, actually appears pleasant.

          2. 4

            What the world needs right now is an open source / cross platform language. Hopefully apple delivers.

            1. 8

              What incentive does Apple have to deliver a cross platform open source language?

              1. 4

                Do we have a shortage of those?

                I imagine this will be much like Objective-C. Technically you can use it elsewhere (eventually), but practically no one will.

                1. 2

                  And Apple is an avid proponent of both, so you can count on Apple to deliver. /sarcasm off

                  Swift is closed source and Apple only. Perhaps we’ll see projects like Mono (for MS C#) that will change this.

                  1. 3

                    … at the moment. There are plenty of signs pointing to them making it open source in the future. Apple don’t have a horrible history with open source; LLVM and Clang being the two major open source language projects they heavily contribute to or created and released. The damn thing is less than 24 hours “old” and people are already bitching that it’s not FOSS. Jesus, just hold your horses.

                    1. 2

                      KHTML guys would like a word with you….

                      1. 3

                        I don’t understand your point. Open source doesn not mean you have to give code back to the original author/project, it means the source is accessable, and that’s exactly what WebKit is. It was much easier for them to make their own fork and control the direction of the code they wanted without having to try and maintain compatibility with KHTML and its differing goals. What exactly is the evil deed Apple committed when it created one of the most widely used open source projects in the world? Most users of the web these days see it through a webkit rendered page, and any one of them can download, build, use and contribute to the project if they want to.

                2. 2

                  This looks like a good place to start reading: http://swift-lang.org/papers/index.php, particularly section 6 (comparisons to other work) of the 2011 paper: http://swift-lang.org/papers/SwiftLanguageForDistributedParallelScripting.pdf.

                  So far, swift seems like a reinvention of dataflow programming, on top of a mesos-like resource manager.

                  [EDIT] Oh, wait, this is the other swift programming language. Damn, we’re running out of names.

                  1. 3

                    Not sure why you are being downvoted. Because the OTHER swift looks pretty damn cool and licensed under Apache license! Thanks for introducing me to the OTHER swift…

                  2. 1

                    If I read well, the language and its implementation are not designed to be cross-platform?

                    1. 1

                      Why? The language itself is built on Objective-C and LLVM, they are both (in a way) open and cross-platform. Let’s wait for the official public release and see if they release it open.

                    2. -1

                      Yeah not going to invest time in a proprietary language no matter how much free money will come my way. There are languages infinitely superior in being open.