13 ms·
Swift 2.2 Released
- brudgers 11y agoLooks like two potentially breaking changes at source level: https://github.com/apple/swift-evolution/blob/master/proposals/0011-replace-typealias-associated.md https://github.com/apple/swift-evolution/blob/master/proposa... https://github.com/apple/swift-evolution/blob/master/proposals/0022-objc-selectors.md https://github.com/apple/swift-evolution/blob/master/proposa...
- Alphasite_ 11y agoAre those not going to be marked depecrated and broken in swift 3?
- ash_gti 11y agoIn Swift 2.2 they're going to add warnings but they won't break previous versions of source (yet). In Swift 3.0 they'll remove the deprecated syntaxes.
- brudgers 11y agoThat's a fair point. In practice, it doesn't mean any less work, just longer to rewrite offending code...or not to. Deprecation still imposes debt.
- Tloewald 11y agoNon deprecation also imposes debt. So does stagnation. So you pick your poison.
- Jtsummers 11y agoBetter than the debt of a changed language/library that allows for multiple and confusing variations thanks to not removing those features (syntax, keywords, functions). It makes looking at old documentation difficult (it's wrong now), but also means that outdated guides aren't still correct (so they'll get culled or corrected more quickly) and we won't have the OpenGL situation.
- alblue 11y agoDon't forget the removal of the C-style for loop, along with the increment ++ and decrement -- operators. https://github.com/apple/swift-evolution/blob/master/proposals/0007-remove-c-style-for-loops.md https://github.com/apple/swift-evolution/blob/master/proposa... https://github.com/apple/swift-evolution/blob/master/proposals/0004-remove-pre-post-inc-decrement.md https://github.com/apple/swift-evolution/blob/master/proposa...
- brudgers 11y agoThe one's I linked to are listed as changes incorporated into Swift 2.2 per the announcement.
- whiddershins 11y agoI am baffled by the for loop removal thing. I just spent a while reading about both stride and for ... in, and I feel like there are any number of cases where I would rather use a C-style for loop.
- xxpor 11y agoI'm not familiar with swift, but Python doesn't have C style for loops either. People just write: for i in range(10): instead.
- vram22 11y agoMore generally, people write: for item in sequence: which is somewhat general (sequences include lists, dicts, strings, tuples, generators, text files and more [2]), and it covers a wide range [1] of use cases. [1] Pun not intended. [2] Basically, any iterable. This include custom iterables you can define, which can then be iterated over using the same standard for loop. A unifying feature of the language: "The use of iterators pervades and unifies Python." https://docs.python.org/2/tutorial/classes.html#iterators https://docs.python.org/2/tutorial/classes.html#iterators
- rat87 11y agowhat sort of cases? Could you use a while loop instead? I feel like (as long as the numerical case optimizes to the same thing) the for-in loop (and occasional use of the while loop) is clearer.
- Sephiroth87 11y agoChanges like this are usually converted automatically by the Xcode migration tool...
- timelincoln 11y agonow they just need to open source Xcode..
- boterock 11y agoswift comes with 'swift-ide'test' which I believe is the linter/codecompleter that would allow any text editor to have the features that xcode has
- akanet 11y agoInteresting! I found https://github.com/apple/swift/tree/master/tools/swift-ide-test https://github.com/apple/swift/tree/master/tools/swift-ide-t..., which seems to be what you describe, but seems a bit tricky to use. Can you point to any OSS implementations of a Swift completer?
- mightykan 11y agoI’m not sure you’d really want the crap-fest that is Xcode’s code. It has so many bugs and issues that it’s a better idea to completely dump it and either start over or give up and adopt something like AppCode, like Google did with Android Studio. Making developer tools is just not Apple’s forte and Xcode’s sad state of quality and performance is clear indication of that. I’m thoroughly convinced that Apple has an internal-only IDE that they use that is far better than Xcode and is actually functional, much like the internal Radar tool. There is no way Apple’s engineers could get any work done if they use Xcode. Or, they should start charging money for it so they could justify spending resources on the dev tools. One of the reasons (among many) that Visual Studio is still the king of all IDEs is because Microsoft charges money for the serious bits of it (Pro and higher).
- alextgordon 11y agoXcode works fine for me. I can't say the same for Android Studio, which seems to require a machine more powerful than a top-of-the-line MBP.
- sghodas 11y ago
- seivan 11y agoHappy about renaming typealias to associatedtype, now I don't have to constantly explain why I am using typealiasis when dealing with bugs.
- AsyncAwait 11y agoAs someone who refused to sink any significant time into Swift until they open-sourced it, I have found it to be the most productive statically-typed, native language out there. Its type system feels like the best of C# and Rust, while it feels that the speed at which one can pick it up is not that much greater than that of Go despite being a much richer language, (I've started learning in January and am at the level now where I can take on a fairly complex Swift project and feel comfortable about being able to finish it in time, plus I now use Swift for almost any programming task, 90% of them at least). Plus, you have to give Apple credit for getting the open-source release right, (GitHub, pull requests, proposals, mailing lists, frequent dev builds, Linux support - I guess Chris Lattner has been the one driving this, but I have to give credit to Craig Federighi and Tim Cook for letting him do it.) The only part that frustrates me is that SourceKit seems to crash every other minute for no apparent reason - but that is no fault of the language itself. Swift is the first piece of Apple software I'm genuinely excited for. Congrats to everyone who contributed to the 2.2 release
- wyldfire 11y ago> the best of C# and Rust e.g.? I've only just scratched the surface of Rust and dismissed C# as a Java clone (but maybe I shouldn't have?). What's some examples of the best of Swift that you see?
- chadzawistowski 11y agoOne case where C# is far superior to Java is generics. Generics were a cutting-edge feature in 2005. Microsoft took the opportunity to start from scratch, and released the .Net Framework 2.0 without backwards-compatibility, and with full support for generics. A List<String> is actually a List of String. When Sun released Java 5, they didn't want to disrupt the established Java ecosystem. Their implementation is called "type erasure". As an example, List<String> is actually just List<Object>, with automatic runtime typecasting to String. https://docs.oracle.com/javase/tutorial/java/generics/erasure.html https://docs.oracle.com/javase/tutorial/java/generics/erasur... Java's solution works well enough, but it breaks down in certain scenarios, such as multiple levels of generics. For example, when getting an element from a List<List<String>>, Object is not cast to List<String> (which doesn't really exist), but merely List. C#'s implementation of generics became even more sophisticated with C#4, which introduced covariance and contravariance. https://msdn.microsoft.com/en-us/library/ee207183.aspx https://msdn.microsoft.com/en-us/library/ee207183.aspx
- pjmlp 11y agoSad Ubuntu LTS user: > error: opening import file for module 'SwiftShims': No such file or directory Apparently the problem with GCC ABI break hasn't been tackled yet. https://bugs.swift.org/browse/SR-23 https://bugs.swift.org/browse/SR-23 As info, the only workaround is to rebuild Swift from scratch.
- iliketosleep 11y agoi can't believe how much people here on HN love swift! do you guys really love stuff like implicitly unwrapped optionals and awkward syntax where you need exclamation marks all over the place. not to mention their insanely complicated use of enumerations. what about a completely half-baked standard libraries where even basic string operations such as doing a substring are unnecessarily complicated and verbose? i simply cannot see any real basis for all the love for swift.
- danappelxx 11y ago>implicitly unwrapped optionals This only exists for objective-c introp, and the creators are actively trying to find ways to get rid of it. On the other hand, in nearly every other language, all pointers would be considered implicitly unwrapped optionals, while in Swift you get optionals built in (food for thought). >awkward syntax where you need exclamation marks all Oh come on, syntax does not define a language. If they used a different character or an operator, would you be more happy? Either way, it does take some getting used to but eventually it feels natural. >insanely complicated use of enumerations What?! This is one of my favorite features! You can represent so many things with an enum and it can make your code much safer. My favorite two examples are representing JSON as an enum, and the fact that Swift's Optional is actually just an enum with cases .none and .some(T). >basic string operations such as doing a substring are unnecessarily complicated and verbose I somewhat agree with you on this. They have their reasons (mostly because strings can have varying sizes, so indexing a utf8 string, for example, can give unexpected results) but I still wish they did something about it.