4 ms·
As an Apple fan and a programming language nerd, I have basically no interest in ever using the language. I spend a lot of time in C++, Haskell, Rust, and Kuber
by wwright 7y ago
As an Apple fan and a programming language nerd, I have basically no interest in ever using the language. I spend a lot of time in C++, Haskell, Rust, and Kubernetes, but Swift just feels pointlessly complicated to me. (C++ I think is also pointlessly complicated, but the rest at least have a point ;-)
- zepto 7y agoSwift is no more complicated than Haskell or Rust.
- verttii 7y agoBut Swift has had a more specific target platform, where it wouldn't make sense to produce excessively high level generic abstractions. Whereas a language like Haskell is happy to try some absurdly abstract concepts in the interest of promoting computer science.
- Tainnor 7y agoIf you don't use complicated compiler extensions (which, to be fair, many people do), then Haskell's complexity is more compositional. There are not a lot of fundamental concepts you need to understand; it's just their combination that creates the complexity (such as typeclasses like Monad). Swift's complexity feels much less compositional. There are still a lot of situations where I won't really know how certain features interact (especially when it comes to generics, associated types, etc.). Also, the documentation on some edge-cases is basically non-existant.
- wwright 7y agoI would Swift is more complex than Haskell, though much more familiar to many programmers. Pure Haskell is pretty simple, all in all. Maybe using it isn’t, given the ecosystem ;-) Swift and Rust are definitely similar in complexity, but Rust actually merits most of its complexity imo. It gives strong guarantees and a strong foundation for the future; I don’t believe that Swift has that. Swift adds a lot of features for the sake of having them, and I think that will catch up with the language quickly (see C++.)
- uwuhn 7y agoI'd like to ask what about Swift feels complicated. I'm really curious because I've heard the same thing about Rust, and I also see Swift compared to Rust often.
- cellularmitosis 7y agoCan you elaborate? Personally, I thought Swift’s distinction between value and reference types was fantastic. https://academy.realm.io/posts/andy-matuschak-controlling-complexity/ https://academy.realm.io/posts/andy-matuschak-controlling-co...
- happytoexplain 7y agoWow, that's honestly not an opinion I've heard! I've always felt that Swift is one of the clearest, most comprehensible languages I've ever worked with. It also strikes me as a great balance between simplicity and flexibility/power/features. I don't want to ask you to dive into specifics, since I'm not doing so myself, but I'd love to hear if there's any standout examples of unnecessary complexity for you.
- gurkendoktor 7y agoAnother Apple ex-fanboy here. I loved the conceptual simplicity of Objective-C and its easy integration with the rest of the C-family world, I really enjoyed Foundation & UIKit around iOS 5, I still use Xcode a lot - but Swift made me slowly move back to a C++/generalist career. As a random example, take the content of this article: https://www.rightpoint.com/rplabs/switch-method-dispatch-table https://www.rightpoint.com/rplabs/switch-method-dispatch-tab... This is something that my less grumpy iOS developer colleagues regularly stumble over, and yet they keep telling me that Swift is super simple. Also, Apple's tooling for Swift has gotten less crashy, but not more reliable in my experience. Almost every time I command-click a Swift function in Xcode to find its definition/source, Xcode shows me a random C function with the same name in some completely unrelated header file. I predict/hope that Combine will be peak Swift, and that it will only accelerate the move to Electron and other portable technologies (go Flutter!).
- Apocryphon 7y agoTo the sibling comments, here are some prior threads about other critiques of Swift: https://news.ycombinator.com/item?id=17278175 https://news.ycombinator.com/item?id=17278175 https://news.ycombinator.com/item?id=15421073 https://news.ycombinator.com/item?id=15421073 https://news.ycombinator.com/item?id=13655125 https://news.ycombinator.com/item?id=13655125
- unpluggedcord 7y agoFWIW those comment sections are talking about swift 2 and swift 3. Which are considerably older and lacking many features that clean up those concerns.
- taharvey 7y agoWhat part of Swift being as fast as C++, as safe as Rust, and with the functional type system of Haskell (but actually useful in the real word) is unappealing?
- wwright 7y agoI don’t have the time to dive into specifics like the other comments are asking for, but I can say that all three of these claims are false. Swift has significant performance penalties for a lot of its functionality; Rust is significantly safer and lower overhead (Swift doesn’t do anything about thread safety or mutable aliases, for starters); and Swift’s type system, as far as I know, is not as advanced as Haskell’s (and also significantly less ergonomic when it does match functionality, imo.) I will say that I think the language made compromises in all three of these directions, though.
- taharvey 7y agoI would encourage you to look deeper. 1. We've moved our company code base from tight C/C++ code to Swift. It is just as fast, with higher level syntax. In some cases faster. It has native SIMD types without external libraries too. Moreover, the Swift group has been focusing on correctness over performance to date. The goal has always been, that its deeply typed design can enable optimizations not even possible in c/c++. 2. Several of the founding Rust team moved to the Swift dev team years ago. As of Swift 5, the memory model supports the Rust-like borrowing. One could say Swift at this point is a complete superset of Rust. But, more importantly Swift favors a functional style of value type operations... which are inherently memory safe, and have no concurrency side effects in the first place. Value types together with Swift's very easy to use Dispatch concurrency library work for most use cases... it is viewed that "borrowing" is only a special purpose opt-in feature. 3. Swift is pragmatic. It is functional in its type system, value type operation, and no side-effect philosophy. But it is multi-paradigm, flexible, and designed for the real-world problems that reflect real programming needs... where as Haskell is arguably an academic curiosity and extremely unlikely to become a mainstream general purpose language.