4 ms·
Also, how come Swift has not taken off outside of Apple?
by jay_kyburz 5y ago
Also, how come Swift has not taken off outside of Apple?
- protomyth 5y agoI would imagine the churn is a big killer and lack of decent documentation on the current version. Apple cannot even keep their example code for their platform up to date. If you are on the Apple platform you have to deal with it, but there are other, stronger ecosystems for other language on other platforms.
- unix_fan 5y agoApple documentation has been like this for years, and its not even limited to swift.
- unix_fan 5y agoWhy would you learn it if you aren't targeting apple users.
- elpakal 5y agomillion dollar question right here
- user-the-name 5y agoBecause it is a really, really good language? It's easily the best language I've used, and I've used many.
- oscargrouch 5y agoIts in the Java, C# family of languages, where you can do pretty powerful things without the complexity of the likes of C++ and (now Rust) with a very good performance. And when you take the family Swift is in, (now also with Kotlin), i consider it the best language over its peers not only given the design, but the fact that being AOT compiled from the start it's of great value. Having said that, i feel inclined to invert the question as, why i would not want to use and learn it? In my experience at least, a lot of IT folks, just don't have the mental energy for the likes of C++ and Rust, but can peak at a language like Java which can already be complex enough. For instance, i deal mostly with C++ all day, and i don't think i would choose it if i were to create an application with buttons, multi-media, etc.. Nor Rust(same problem as C++) or Go(poor design for that goal). Given there's a language like Swift which combines the design and speed/efficiency to create such a thing. If i were to create a backend service for instance, i would take Go into consideration, and probably in that case it would be a better fit than Swift or Rust or C++.. So its about being the right tool for the job.
- b3morales 5y agoI'd dispute that you can achieve high performance in Swift without paying a similar Rust/C++ complexity cost. You can write high-level GUI code that is relatively straightforward, but if you are about speed and memory usage, there is a lot of intricate knowledge you need about what things to do and which to avoid.
- oscargrouch 5y agoOf course, if you want a very efficient application, you are completely right. But the thing is that with Swift you can get a Java like performance (which is pretty good) out-of-the-box even while paying the ref-counting penalty, without the Java memory penalty (it has a low memory footprint) and without having to run it all with a external VM. Of course, if you want to catch-up with the average speed of C++ you will need some effort, but knowing that it will be pretty fast without much effort and without all the other penalties is reassuring.
- travisgriggs 5y agoMy personal opinion is because Swift has turned into an "us too" language. There's a large rush for all popular language ecosystems to rush to whatever trendy development exists in language design now days to retain the momentum of community. I write/maintain a decent amount of code in Swift these days. I'm proficient in some parts of it, clueless in others. Like Kotlin, and Javascript, and even Python to some degree (I do a lot of Kotlin and Python too), these multi paradigm languages are sort of a "use it however you want." There's no unifying simplicity in them. So it becomes a race to the bottom of utility. Why use Swift, when it looks and feels like so many other languages, and when it's clear the rate of the changes in it will primarily benefit Apple? To be clear, I don't hate Swift at all, I like some bits of it, it's just that there's no real draw for me to play with out side of the Apple eco system. If Apple made it so that I could use it write Android apps with it (kinda like Dart is supposed to be), I would be much more excited about. If Swift was dedicated to a small set of unifying principles (kinda like Elixir), I could get more excited about it.
- bmc7505 5y agoFor the record, Kotlin was open sourced Feb. 13th, 2012 [1]. Swift was open sourced Dec. 3rd, 2015 [2]. So while the first commits happened just a few months apart [3, 4] and these languages may have shared similar influences, Kotlin predates Swift by almost four years in the open. Perhaps their ideas simply were in the air ten years ago, but I think it would be unfair to insinuate that either language was in a "rush to whatever trendy development exists in language design". [1]: https://blog.jetbrains.com/kotlin/2012/02/kotlin-goes-open-source-2/ https://blog.jetbrains.com/kotlin/2012/02/kotlin-goes-open-s... [2]: https://developer.apple.com/swift/blog/?id=34 https://developer.apple.com/swift/blog/?id=34 [3]: https://github.com/JetBrains/kotlin/commit/369b1974782b821e44b7aa6cd68e2e41eb2ba036 https://github.com/JetBrains/kotlin/commit/369b1974782b821e4... [4]: https://github.com/apple/swift/commit/afc81c1855bf711315b8e5de02db138d3d487eeb https://github.com/apple/swift/commit/afc81c1855bf711315b8e5...
- travisgriggs 5y agoI was not trying to imply that they stole from each other. Kotlin may have been around longer, but it did not enjoy the early momentum and energy that was granted because of Apple's energetic adoption and marketing. JetBrains didn't have the early resources to dump into Kotlin at first like Apple gave to Swift. In fact, I would posit, that if Swift had not gotten a giant kick off from Apple, Google may have never felt so compelled to support Kotlin like they did. They may have been fine "just do it with Java, or you can use JetBrains stuff if you want" indifferent attitude that existed for much of the early life of Kotlin. Both languages want to remain objecty. But have added "systems" features. And are more functional. And more asyncish. And more actorish. More saftey-ish. So on and so forth.
- VWWHFSfQ 5y agoUnless you're making iphone apps there are much better languages for nearly every use case that are already heavily adopted
- kitsunesoba 5y agoI wish I could use it in more places. It checks most of my boxes and I feel reasonably proficient in it, so I would love if I could it in place of say C# on Windows or in place of C++ or Rust for cross platform desktop development. Swift is also the bulk of what I write for my day job, and it's always nice to not have to allocate mental resources to the differences between languages when trying to work on personal projects in one's off-time. It's so nice to just sit down and just start writing code without having to spend a ton of time googling "how to do X in Y language".
- cachvico 5y agoPerhaps because everything else that Apple does screams "WALLED GARDEN" so the world is now wary af.
- Redoubts 5y agoEven though it was obviously beta, there was a lot of early churn in the language and libraries. Some substantive, some trivial. And even in later versions, they like doing October surprises with language features, despite being open in development (SwiftUI and all it’s crazy dsl support came outta nowhere) But the Linux story was garbage through v5, with half the standard library being unimplemented, and you getting to find out only at runtime. Also, swift on Linux was (is) still just “here’s a tarball, dump it somewhere” or build from source. That and the fact that static binaries aren’t a thing without a lot of work, if at all, means you have to ship a 2gb runtime to do anything — which sucks for casual tools. I love the language but it feels like a bad time anywhere but on Darwin
- elpakal 5y agoI feel like the lengthy focus on the Swift for Tensorflow project by some of the key Swift figureheads (including Chris Lattner himself) slowed Swift done a lot. SFT was eventually scrapped, and I can’t help but wonder where the language would have been if those minds would have focused on things like landing async/await & ABI stability earlier and working on other new language features.
- jraph 5y agoWhen Swift was released, it was not open source. At the moment it was open sourced, Swift was not in the news anymore and I remember thinking "ok, whatever". I wonder if this late open sourcing contributed to this. And yes, from the outside, it seems very Apple oriented. For any use case outside Apple there seems to be a (more?) suitable language.
- alblue 5y agoThere’s a few reasons, but mostly is due to economics and the way Apple builds its own software. Swift came out of the iOS side of the company, and was sponsored to make writing iOS apps easier. It was therefore constrained to fit into a particular shape; in particular, Objective-C compatibility was a must have. Many of the frameworks and libraries on iOS/macOS are implemented in Objective-C including “std” libraries like Foundation. When building Swift for Linux/Windows, there isn’t an Objective-C ecosystem, and rather than introduce one, instead the language just doesn’t have support for that. As a result, the “std” libraries are a complete rewrite of the libraries available on macOS. Even being able to include Posix basics used a different library name; Darwin vs GlibC. [There was a long battle to try and get a meta import of LibC which would import the right one on different platforms.] So there are really two dialects of the language: Apple Swift and Linux/Windows Swift. They share the same overall feel but is like the difference between Diesel and Petrol/Gas. Same overall outcome, different completely under the hood. Two other reasons exist; firstly, the internal builds are a fork of the open source project, so when a new feature lands on an iOS device, code and libraries are written to support that (eg SwiftUI) and nothing related to that fork lands until after Apple have announced it. What that means is you get giant blobs of diffs on an annual basis; in some cases, reverting bugs that have been fixed already in the open source world (because the internal version was forked six months previously). The other reason is that Swift depends on a forked version of llvm/clang, to the extent where you have to install those to be able to compile Swift programs. Many upstream distributions already ship their own clang, which is essentially incompatible with Swift, but they want to follow their philosophy of only one version of a library (and don’t want to replace their own version with a Swift specific one). So, Swift on iOS is a primary platform, and if you are writing iOS apps is the standard way. Every other platform is a second class citizen and software project management at Apple is not well suited to an open source workflow; since the iOS team are calling the shots on swift (and paying for most of it, to be fair) then the language evolves for their benefit primarily and then others as a side effect.
- heavyset_go 5y agoLast time I looked, it didn't have a stable way to export a C-compatible ABI for FFI. Unless the majority of your project is in Swift, or there is are bridges for the project's other languages, interop with existing code can awkward or expensive.
- flohofwoe 5y agoThere are so many languages to choose from that don't take off outside their niche, why would Swift be different? From an outsider's perspective, Swift is an attempt to replace ObjC as the "macOS/iOS platform language" with something that feels a bit more '21st century' (for better or worse), so it plays the same role as Kotlin on the Android platform. IMHO a better solution would have been to provide more "language-interop-friendly" C-API wrappers for high level macOS framework APIs, so that it's easier to write macOS and iOS applications in all sorts of languages (the same applies to Android btw). But the NIH seems to be strong at Apple, so Swift it was instead.
- andrekandre 5y ago> IMHO a better solution would have been to provide more "language-interop-friendly" C-API wrappers for high level macOS framework APIs, so that it's easier to write macOS and iOS applications in all sorts of languages that was arguably easier with obj-c already, and had java, then ruby and python [1] lnguage interops but alas were not popular... [1] https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/CocoaFundamentals/WhatIsCocoa/WhatIsCocoa.html https://developer.apple.com/library/archive/documentation/Co...
- pjmlp 5y agoThe same reason as Objective-C did not took off outside NeXT/Apple, you just get the bare bones compiler without the ecosystem.