back
108 comments
It looks like a really well thought out language, and the willingness to break some things that looked like C holdovers in 3.0 for future clarity is also interesting.

I'm wondering if Swift will hit a sweeter spot than Go (GC, weird takes or delay on things like packaging, generics) and Rust (complexity) for userland systems software.

My intuition is the Swift ecosystem will struggle against conflation with particular platforms, i.e. iOS and OSX. This struggle is common among languages: C# with Windows and JavaScript with the browser come to mind. Historically, C faced similar association with the Unix platform. Language platform conflation makes it difficult to parse information from blogs, books, and StackOverflow: the worst offender of course is Javascript where the presentation may be based on jQuery or NPM dependencies even for things practical in vanilla Javascript [or rather ECMAscript].

Outside of Google, using Go tends to be a decision made among a wider range of technical options whereas Swift is very often "not-ObjectiveC." To put it another way, Google created Go as an inhouse alternative for applications where Python, C++, or Java might have been the choice previously. A wide language range: even more considering the range of Java alternatives [Scala, Clojure] on the JVM.

A third factor I see with Go is the Clojure effect. The median Computer Science and Engineering knowledge in its community tends to be high relative to languages chosen based on platform limitations, institutional standards, or "this is the language I know".

I've left out Rust because I don't see it as likely to achieve the scale of adoption of Go or Swift...and saying that I should clarify that I think that platform binding, and a few billion platforms at that, will mean Swift is likely to instantiate more lines of code than Go. Clarifying further, I think Rust's adoption will be a matter of power law distribution not technical shortcomings.

Apart from swift on iOS/mobile which is gigantic, you are underestimating the push for Swift by enterprise players (IBM,SAP..). The next big frontier for enterprise applications is cloud, IoT and of course mobile (buzzwords or not). Java is increasingly being used by Oracle to extract revenue, there is no guarantee they will not change their mind and start charging fees from future versions as their other businesses (database, apps etc.) shrink.

The major enterprise players are not going to let Java (with Oracle stewardship) continue to be the language for the next generation of enterprise platforms and be at Oracle's mercy. Swift is open source and apple enterprise agnostic, easy to see other enterprise players pile on this language. IBM and SAP already on board. If you remember, this is how Java came to dominate enterprise space. Don't be surprised if Google release some sort of compatibility layer for Android.

[Case for bringing Swift on the Server by IBM]

https://www.infoq.com/presentations/swift-server

You are also overestimating Go's influence. It has been five years since the language release, it seems to have settled as a niche language like Clojure and topped out. Unless some major platform adopts it, it will remain a niche area. It certainly hasn't replaced (or even come close to) Python, C++, Java in any sense.

Maybe it will differentiate w/ the flavor of their libraries? It seems Go is the go-to networking and low level language, whereas Swift may be better for graphical applications and user-facing apps?
I've written a fun little OS X/iOS game in Swift 2.0 and found the language incredibly satisfying. Swift 3.0 seems to bring a ton of improvements including some of the bugbears I encountered during that first project.

It's probably mostly personal preference, but I prefer Swift's approach to things over Go or Rust. Go in particular does a lot of things that I personally find obnoxious (capitalization of method names indicating exporting instead of using a proper keyword I find particularly egregious, but I also find the := assignment operator annoying as well.)

Swift is the first language I've learned in a while that had way more "OH yeah that's awesome!" than "What?! Why did they do that?"

I actually find Swift and Rust to be pretty similar in how they approach things from the end-user perspective, (I think of Swift as application-level Rust), it's just that Rust targets a different market which involves quite a bit more complexity in its domain, which is reflected in the language where needed.
> It looks like a really well thought out language

Well, I think it could have been more cleanly designed if it was able to abandon the burden of Objective-C interoperability. (But Apple can't do this, obviously.) The standard libraries could have also been much cleaner if it didn't rely on NextStep. Also, I don't personally like the dichotomy of value types and reference types, but YMMV.

You say

> it could have been more cleanly designed if it was able to abandon the burden of Objective-C interoperability

You mean this for the language itself and not the (standard) libraries; right?

> The standard libraries could have also been much cleaner if it didn't rely on NextStep.

I agree.

I'm wondering if Swift will hit a sweeter spot than Go

I think Swift will be a Go killer.

How does Swift handles concurrency ? does it have CSP with channels, and a select statement ? because if it doesn't it's not going to kill anything.
The practical side of me welcomes a language that can be used both on the client and server, and on both Apple and non-Apple platforms.

The idealistic side of me notes that Swift seems like a far more complex language than Go, so if Swift kills go, it will be bittersweet.

I'm curious how Swift is getting adopted on Linux and what success folks are having in writing Linux command-line apps or other apps?
IBM is betting on it as a programming language for enterprise applications. Expect a Swift EE coming from them.

Microsoft also acknowledged that Swift support is the top request for their iOS bridge.

I've built a few simple apps running on Linux that have worked great.

Check out Zewo[1]. They've been doing a lot of great work to make Swift 3.0 on the server work really well. Also, check out VeniceX[2] for concurrency and Open Swift[3] for cross project standards[3].

[1]: https://github.com/Zewo/Zewo/ [2]: https://github.com/VeniceX/Venice [3]: https://github.com/open-swift/docs

2nd most starred web framework for Swift:

http://github.com/qutheory/vapor

Works on linux.

I don't know - this is a language that can't easily handle concurrency. Instead you mess around with dispatchers. And then you're dealing with thread-unsafe structures, objects, arrays, etc.

This is such a critical thing with todays interconnected apps that i have no idea how they did not worry about it from the start. Having had the pleasure of dealing with threads, mutexes, dispatchers, execution-contexts and the like there is no way i'd pick up a language that hasn't evolved in that regard, especially on a server. Even Javascript has this figured out with stage-3 async/await.

I did not realize that we were this close to Swift 3?!

This is really awesome news. I'm pretty excited to see what they do in 3.0, I'd love to have another language under my belt without fooling around with NS-nonsense. That they might actually take Linux desktop seriously is really exciting to me also.

I'd love to see a widely-used tool where games and popular apps that would traditionally be put out on Win/Mac are able to be used seamlessly on Linux also. On top of that, I definitely don't want to write Java, I definitely don't want to write ObjC, etc.

Interestingly enough, I think this might even compete with Dart, which I suspect will end up getting Wasm support and ultimately replacing Java for android development... (Just a wild shot in the dark...) So I can't wait to see what the Swift starts brewing up in the Concurrency department.

How exciting!

> I did not realize that we were this close to Swift 3?!

WWDC is June 13-17, so they basically have to have something ready by then. Not so coincidentally, June 13 is "4-6 weeks later" from the May 12 date for making the release branch. Similarly, the late 2016 release for the final version of Swift 3.0 is probably actually mid September, since the version of Xcode with iOS 10 support has to ship before the next iPhone model.

Hurrah for marketing-driven release schedules.

It's good that they are making these breaking changes now. I like the language and the changes they are making.

The next focus should be on performance in my view. String processing in particular is too slow to be usable for server-side tasks.

Also, I wonder what to do with Foundation in the long run. It's huge but its design is extremely antiquated. At some point Apple will have to shed that past where URL manipulation and file system operations are methods on a string class.

Regarding strings...

I briefly ran the code sample you graciously provided me with a month ago through the profiler (https://gist.github.com/austinzheng/d6c674780a58cb63832c4df3...).

Long story short, it looks like the reflection machinery in the standard library is improperly being used to construct String instances. Doing so, while probably not sufficient to account for the entirety of the awful performance, is probably quite expensive. This looks like a bug and I'll try to dig deeper into it this week.

Swift also badly needs a native version of NSCharacterSet, even if only for programmer ergonomics.

The developer in charge of the standard library has mentioned that that team intends on redesigning the String API in the near future; this should provide an opportunity to reexamine the performance implications of the current implementations.

Foundation is being completely rewritten in Swift in https://github.com/apple/swift-corelibs-foundation

The first proposal for bringing Foundation APIs to this decade has already been accepted for Swift 3: https://github.com/apple/swift-evolution/blob/master/proposa...

You can already do URL manipulations with NSURL and NSURLComponent, it took time but almost all file system methods can take an NSURL now instead of a NSString.
I've had a quick look on 3.0 changes and didn't find major features related to protocols. I'm thinking of things like more complex generic type constraints, or a mechanism to better code against protocols ( see all videos that talk about swift protocol oriented in "real life" and how annoying those limitations).

Did i miss something ?

That was discussed by Apple Dev Douglas Gregor in a massive post here:

https://lists.swift.org/pipermail/swift-evolution/Week-of-Mo...

It's not clear what the schedule would be but I suspect a number of the constraints changes will be in Swift 3.

I would love it if Swift could become the next-gen C++ for cross-platform development. The Apple platforms/Linux advances are great but is it ever going to be adopted on other platforms? I don't think Apple would care, it's mostly Lattner & the team behind pushing the language. (bless 'em :))
Swift is more like Java ecosystem than Rust is ideal as the next gen C++. Otherwise, Obj-C would have been popular when it tried to compete with C/C++. There was an article mentioning.
I was hoping to see some changes to the error handling. The extensive use of implicitly unwrapped properties always makes me nervous because basically we still have the null pointer dereference problem. Also, optional chaining seems really well geared to the use case where silent failures area OK, but things get ugly quickly when trying to handle individual errors. Maybe I've just been spoilt by Rust, which I've been learning at the same time, but their approach to error handling seems much more holistic and less tacked on than in Swift. I'd definitely like to see more done with this because that feels like the only complaint I have with the language.
Anyone know how Swift performance compared to Scala? Those are pretty similar, I've heard. I'm pretty familiar with Scala, but not Swift. Is there any reason to switch to Swift?
The main thing to know about Swift performance is that it varies hugely depending on what you're trying to do. I think it will take some time for the implementation to mature to a point where it becomes less hit and miss performance-wise. Swift as a language has all it takes to create a consistently fast implementation.

The wildcard is probably the decision to go with reference counting over a tracing GC. We'll see how that works out. There are good arguments on either side.

They aren't so similar. Feature-wise, Swift is much closer to Kotlin, which is (on purpose) significantly simpler than Scala.

Also if you're using Scala, there's a huge ecosystem of libraries and frameworks that just doesn't exist in Swift. If you want native compilation, just wait for http://www.scala-native.org/

I haven't seen any data. Scala has been around for a while, which means more time to spend on optimization, so it's probably faster at this point. Because of garbage collection on JVM, Swift has the potential to be more performant though.

Unless you are trying to build some really high performance shit, what really matters is developer productivity, which is abysmal for server-side Swift right now. Getting better every day though.

Source: built and deployed a service in Swift

> Swift performance compared to Scala?

Depends how you write the code :-)

http://benchmarksgame.alioth.debian.org/u64q/compare.php?lan...

I really don't like the way that objective c express everything, so i was looking forward to Swift.

This tells me that Swift is not ready for prime time 3 versions later:

"Swift 3.0 is a major release that is not source-compatible with Swift 2.2. It contains fundamental changes to the language and Swift Standard Library. A comprehensive list of implemented changes for Swift 3.0 can be found on the Swift evolution site."

Fundamental changes??? Let me know when is stable across versions.

Since apps include the swift runtime library though, changes won't interfere with your current apps.
The reason there are so many fundamental changes right now is because they want to stuff all breaking changes into Swift 3, and be stable after that (naturally with new features going onwards, though). Once Swift 3 comes out the language will be very stable.
Maybe I'm too old school but the removal of for loop is quite surprising.

for-in doesn't tell you the index of the current object so you'd have to manually keep track of the index.

Also, x++ is a common syntax in many languages and I think a new developer looking at Swift would try that first before using the other syntax (x += 1).

I think what a new developer would try first isn't a particularly good yardstick for language design. But I also think that the removal of ++ causes some problems.

For instance, now I have this code

    mutating func next() -> Element? {
        //...
        pos += 1
        return data[pos-1]
    }
or alternatively

    mutating func next() -> Element? {
        //...
        let e = data[pos]
        pos += 1
        return e
    }
where previously I had

    mutating func next() -> Element? {
        //...
        return data[pos++]
    }
You have access to the index in a for-in:

for (index, element) in list.enumerate() { print("Item \(index): \(element)") }

> for-in doesn't tell you the index of the current object so you'd have to manually keep track of the index.

Functional decoration trivially provides that. Just zip a counter with the backing iterable, and modern languages generally provide that OOTB as a variant of `enumerate()` e.g.

    for i, item in it.enumerate():
        # stuff
> Also, x++ is a common syntax in many languages

Meh. It's generally present in B derivatives (via C) and that's pretty much it. Most languages do just fine without it.

I was hoping all Swift professional are motivated to contribute patches, features and tuning performance to Swift 3.0 in a swift pace instead of until 2017. Release Process is such a lengthy discussion that could have been shorten and spending more time on improving code.

Why not using JIRA?

What I really miss is a proper compiler for Swift. I've encountered two bugs in the last few days: one in the IRGen and the other one in the TypeChecker. That can be really annoying. And that error "expression is too complex to evaluate" is just ridiculous.
Any talks about Windows port?
Microsoft staff have recently did a preview ported at Codeplex https://swiftforwindows.codeplex.com

Disappointed, only for Windows 10.

It'd be nice if they stopped breaking the language at some point. I don't want to rewrite my program every year. I would have called that future stable version 1.0 (like, say, Go and Rust did).
Version 3.0 is supposed to have a much stabler API going forward. They've been making a lot of changes even since 2.2 that really clean up the standard library.
Today I have submitted a proposal for "memorization", "memo", "memorize" keyword for a function that allows to run only once through out the lifecycle in Swift 3. Repeatedly execute the function will only return the same result without having to rerun the function everytime. As far as, I don't see my submission is being visible for discussion.

  memo func hello(fname: String, lname: String) {
    return fname.lname
  }
Is this not better suited to GCD operations? dispatch_once handles this exact use case.