https://github.com/apple/swift-corelibs-foundation/blob/mast... says they intend it to be part of Swift 3.0, but https://github.com/apple/swift-corelibs-foundation/blob/mast... still lists a lot of classes as "Incomplete" or "Unimplemented"
Not that I mind though. This kind of thing should be easy to auto refactor.
Now the risks were known when we green fielded the project. It was certain that Swift syntax and the frameworks would change in the future. But the time we saved in development makes up many times for the maintenance burden now.
Luckily refactoring strongly static typed code is not that of a fiasco :)
But one of the things I like about how the language is begin developed is that everyone involved is aware that having the language in a constant state of flux is painful, and try to provide useful warning messages (or wizards if you use XCode) for those that will need to update their code to a newer release sooner or later.
But I wish Python 3 did the same with its libraries.
if foo == 1 && bar ==2 //normal, from other languages
if let somevar = foo, let anothervar = bar //note, must use a comma rather than &&
if case .someEnum = foobar //cannot use == !
That latter would be much easier to think about like foobar == .someEnum but it gets mucked up.
I don't understand why these can't be streamlined into something like this:
if let a = b && let d == f && foobar == .someEnum //you can't do any of this
Instead, you have to use "where" and commas rather than && in some places, the whole thing is a much greater cognitive overload than it should be for such a fundamental task in any language.
* you can write "foobar == .someEnum" if you've defined "==" for your enum type (in Rust that's a deriving(Eq) away, sadly Swift doesn't seem to have deriving):
// requires conforming to Equatable, and implementing
// requires func ==(a: Foo, b: Foo) -> Bool somewhere
// if the enum has associated data[1]
let v = Foo.Bar;
if v == .Bar {
print("ok")
}
you can also do that with optionals by default: let w = Optional.some(3)
if w == .some(4) {
print("ok")
}
* `let a = b && thing` doesn't make sense because `let a = b` is not a boolean value it's a pattern match. That's why you have a separate guard (the where) and have to write `let a = b where thing`, this is what happens in pretty much every language with pattern-matching (though syntax may vary)* `let d == f` makes no sense whatsoever, though as previously noted `f == .some(d)` works
* you can compose `if case` and `if let` in, since both are pattern matches, `if case .Bar = v, let b = w` works fine
If you're getting lost with that, use the regular `if` for boolean stuff, and a full `switch` for all patterns. There, I fixed it.
That aside, I do agree Swift's syntax is convoluted and complex. Part of that comes from `if let` being special-cased to optionals, which is convenient when you're working specifically with optionals but means a separate syntax for other enums.
On the other hand, most languages with pattern-matching don't provided a "conditional-ish" version, Haskell's `if` works solely on booleans, if you want to work with patterns you have to break out the full `case`. Rust lifted `if let` from Swift (with different semantics) because it was such a neat idea.
[0] http://www.andrewcbancroft.com/2015/07/01/every-swift-value-...
[1] for trivial enums (no associated data, though they can have a rawValue), you can just `enum Foo: Equatable` and it'll get a proper implementation; for the rest you have to implement == yourself: http://www.jessesquires.com/swift-enumerations-and-equatable...
Why wouldn't enums be equatable by default? Why rely on a user implementation of ==? Enums, even with associated data, are rather obvious values, aren't they?
As well, I'm happy to let the keen early-adopters be the guinea pigs. Xcode 8 only came out today. If you have production apps, it's madness to upgrade on day one. I'll wait a few weeks/months for the remaining bugs to shake out.
Don't get me wrong I'm very pro-Swift. But I'm also mindful of my time and sanity. Switching to a new language sure sounds fun, but not exactly productive (in the short term). When I do switch, I want everything to be rock solid, stable, all the tools, docs and everything.
But I have created a couple of toy projects in Swift, and I'm very excited to start using it properly in a year or two.
I am surprised they don't support the latest Ubuntu with official binaries?
Funny thing is I downloaded one of the first if not the first beta of Xcode 8 and it already migrated my projects flawlessly (where possible). It's all the other stuff that's broken.
Haven't tested it yet with Xcode 8 but I fear it won't work.
[Update] Hmm, seems so. See this: https://github.com/inket/update_xcode_plugins
I also encourage you to file a radar [2] to let Apple know you're not pleased about them killing a thriving plugin ecosystem. Yes, I know there's a new plugin API but it's so crippled that 90% of the plugins on Alcatraz couldn't possibly move to it. If enough of us complain maybe they will listen.
I've already spent all day fixing, updating, searching around for all kinds of errors that the build system throws at me. It also required me to update the project dependencies to their latest versions which support swift 3/xcode 8. Some dependencies (like SwiftBond 5) have changed a lot and now my project has hundreds of syntax errors due to renamed methods, not that hard to fix, but not sure if they'll still run the same...
So this is a major upgrade to your project - do it when you have spare time to waste.
In the meantime, I'm thinking of reverting to Xcode 7.3 and running the two versions side by side... Is that possible ?
I think you're probably better off just keeping Xcode 8 by itself, but use Swift 2.3 for projects if you need to. There are very very few differences between 2.2 and 2.3, converting existing code over is much faster than 2.2 -> 3.0.
Basically, I couldn't get my carthage dependencies to compile with Swift 2.3, so I went the Swift3 route, which now, after 10 hours wasted, was such a bad idea!
Appstore was bugging me to update Xcode so I caved in and now I'm stuck with a project that doesn't build and the deadline approaching fast. Such a useless waste of time.
EDIT: See steveklabnik's comment https://news.ycombinator.com/item?id=12495200
If Swift really wants to become successful, they need to work on bigger picture things like fixing breaking regressions, planning full reflection, built-in async instead of bikeshedding about array methods. I understand they want a non-breaking API from 3.0, but everyone isn't always going to be happy; and changing small functions for the vocal minority is not the correct path forward.
A list of 3.0 regressions: https://bugs.swift.org/browse/SR-2603?jql=labels%20%3D%203.0... Flatten rename proposal: https://github.com/apple/swift-evolution/blob/master/proposa...
Also, breaking changes such as this one were a lot easier to make in Swift 3 than in a later version.
This created havoc in Python. Hopefully it won't happen here.
There are big differences though:
* Python had 15 years of source-compatibility before the switch, Swift has 1 year and a history of source-incompatibility (Swift 2 was not source-compatible with Swift 1)
* Python had a fair amount of semantic-incompatibility
* Python doesn't have a (heavy) compiler backing it up making source and semantic incompatibilities runtime issues your program bashes its face in rather than cascading compilation failures
Swift 3.x has a large amount of syntax changes. The compiler helps with the refactoring but it's still work.
Swift 3 is a source-breaking release, largely due to the
changes in SE-0005 and SE-0006. These changes not only impact
the names of the Standard Library APIs, but also completely
change how Objective-C APIs (particularly from Cocoa) import
into Swift. Many of the changes are largely mechanical, but
they can be numerous in a typical Swift project.
To help with moving to Swift 3, Xcode 8.0 contains a code
migrator that can automatically handle many of the need source
changes. There is also a migration guide available to guide you
through many of the changes — especially through the ones that
are less mechanical and require more direct scrutiny.
[0] https://swift.org/blog/swift-3-0-released/The migration tools are quite good though so going from 2.2 to 3.0 directly should not be much of a problem.
I think that in Python the problem was/is that the 2.x was already a massively used and mature language when the 3 came out.
Apple has the resources to push this through and developers don't really have much choice so I don't expect this to become another Python 3 fiasco but this really should be the last time Apple breaks so much code just to clean up the syntax a bit.
This way, the language can evolve into a fine language with many features from Algol-68 and the usual semi-popular C-ish syntax, and Apple can continue to ensure that developers have to maintain a separate codebase for their "apps" that is useless anywhere else.
Swift was started in July 2010 by Chris Lattner[1] and it was publicly announced by Apple in June 2014 (and the 1.0 release was September 2014). Spending 4 years on it and including other programming language experts to contribute to it doesn't seem like a reckless and thoughtless release. What it shows is that even if a group spends years on it, they will still get a lot of things wrong. Same for C# that was (formally) started in January 1999 and not publicly released until December 2002. Even though that language also had 4 years of gestation by smart people, they still got generics and a bunch of other things wrong (e.g. terrible name of "destructors" for the concept of finalizers.)
I didn't realize that programmers thought Swift was created in a hurry like Brendan Eich's "10 days" to design Livescript/Javascript for Netscape Navigator[2]
[1]http://www.nondot.org/sabre/
[2]https://www.quora.com/In-which-10-days-of-May-did-Brendan-Ei...
> For Swift 4, the primary goals are to deliver on the promise
> of source stability from 3.0 on, and to provide ABI stability
> for the standard library.
https://lists.swift.org/pipermail/swift-evolution/Week-of-Mo...One of the features of Swift is being cross platform. A good 20% of the page that this post links to is talking about their cross platform progress for linux and windows. https://swift.org/about/#swiftorg-and-open-source
... then again, seeing some actual refactor support in Xcode would be pretty great too, but you can't wish for too much at once.
As for me, that I tinkle more with .NET, I see their (Swift's) grass greener in the fact that they are not afraid of making breaking changes if they truly benefit the platform, something which I don't see MS doing anytime soon.
MS have made plenty of big changes recently, .NET Core being a prime example.
Rather, both are borrowing from older functional languages. These features are relatively new for procedural languages so it seems like Swift borrowed from Rust, but both have borrowed these features from other languages.
Rust did borrow `if let` from Swift (might have existed in other languages, but Swift is where the idea came from). I'm sure there are a few features swift has borrowed from Rust, but not many.
And it's not a bad thing to borrow! (As a Rustacean) I'm happy that Swift is similar to Rust. One of the problems with Rust is the learning curve for folks coming from other languages. With more languages similar to Rust, this is less of an issue. Swift in particular is set up to be used a lot since Apple is pushing it in its ecosystem, which is great.
Disclaimer: not an expert on this subject.
[0] http://scottmeyers.blogspot.nl/2015/11/breaking-all-eggs-in-...