8 ms·
I just... completely don't understand the appeal of Swift beyond it being Apple's in-house language. I was excited for Foundation to become open-source. Using
by thrwawy74 3y ago
I just... completely don't understand the appeal of Swift beyond it being Apple's in-house language. I was excited for Foundation to become open-source. Using a language you'll really only find in 1 environment is a negative. I'm going to go feel ashamed for not getting excited about a language now. I should be celebrating "more languages", but Swift is just Apple. No one outside Apple chooses Shift unless they want to build something in Apple's ecosystem.
- carbocation 3y agoAs someone who mostly writes Go, I enjoy Swift the language. I am guessing that your concerns are centered on Swift the ecosystem? (E.g., it's only used for Apple things, so there are probably not libraries for Thing X.) If so that makes total sense to me. If not, I'd be interested to hear more.
- 29athrowaway 3y agoThere was a lot of excitement when it first came out. I tried Swift for Linux, and soon realized it was a meh experience (NS this, NS that... NextStep is still there) and switched back to Rust. It could have been a strong Rust alternative.
- dwaite 3y agoThat is partly what this article is about - a swift-native set of foundation modules.
- 29athrowaway 3y agoYeah but I am too invested in Rust right now
- vxNsr 3y agoWhile generally true that you’re not gonna find swift anywhere else, this company[0] is making their browser cross platform and using swift as the language. Apparently there’s a proof of concept runtime for windows that they’re actively working on. [0] https://arc.net/ https://arc.net/
- brink 3y agoSeems a lot of people feel the way you do. I had to make something using swift once, and could barely find a community to help me decipher the cryptic swift documentation centered around their coreml library. Apple is keeping Swift on life support, imo.
- blululu 3y agoCoreML is a bit of an exceptional challenge beyond just Swift. Admittedly it could really use a lot more documentation from Apple, but it would be unfair to judge swift based on an uncommon and under documentated library (I suspect that it would get a lot more use if it were not so hard to set up).
- lyu07282 3y agoIf they just had a proper cross platform standard library and package manager it might be more successful, it is a pretty cool language. But the north Korean esque closed apple ecosystem makes that impossible, all of that is intentional.
- pilif 3y agoThe package manager has been open source, cross platform and available since pretty much from the start. The standard library is becoming cross-platform as we discuss it here.
- realusername 3y ago> The standard library is becoming cross-platform as we discuss it here. I'd argue that it's too late already, the ship has sailed, Swift is heading the same way as C#.
- qaq 3y agoIs there an alternative with similar features and ergonomics? I am def. not aware of one.
- realusername 3y agoFor which purpose? It depends what you want to do with it.
- qaq 3y agoWell lang features do not really depend on the purpose the 3d party libs do. Let's say the purpose is web services.
- realusername 3y agoI doubt the web story in swift is that strong anyways, I'd pick python, ruby or php.
- shagie 3y agoIBM briefly did a "swift on the server" though at the beginning of 2020 IBM was no longer interested, but the page is still up. https://developer.ibm.com/languages/swift/ https://developer.ibm.com/languages/swift/ 2016: https://9to5mac.com/2016/02/22/ibm-swift-cloud-kitura/ https://9to5mac.com/2016/02/22/ibm-swift-cloud-kitura/ 2016: https://www.infoq.com/presentations/swift-server/ https://www.infoq.com/presentations/swift-server/ 2020: https://www.infoq.com/news/2020/01/ibm-stop-work-swift-server/ https://www.infoq.com/news/2020/01/ibm-stop-work-swift-serve... You can run it in docker: https://hub.docker.com/_/swift https://hub.docker.com/_/swift
- awill 3y agoThis was so predictable. I remember those articles, and thought "Gee, IBM doesn't know what they're doing, they're just jumping on random bandwagons"
- artificialLimbs 3y agoStill waiting on Apple Silicon DB2 driver. Any day now, I know it!
- yieldcrv 3y ago> but the page is still up. for now just saw an article about IBM deleting most of their website because its a mess. It was some linkedin developer's post.
- ayewo 3y agoLink to the recent post about house cleaning to remove 80% of IBM's website (though on Twitter not LinkedIn). https://twitter.com/bryanfcasey/status/1659941975519375360 https://twitter.com/bryanfcasey/status/1659941975519375360
- GeekyBear 3y ago> just... completely don't understand the appeal of Swift beyond it being Apple's in-house language. It's like Rust in that it offers memory safety by default without a big performance hit.
- kevingadd 3y agoFrom what I've seen the ref counting can cause a big performance hit. Maybe this has improved in the last couple years?
- GeekyBear 3y ago> From what I've seen the ref counting can cause a big performance hit. Apple has been writing OS components in Swift for a while now. It certainly doesn't seem to be producing the performance issues we saw when Google attempted to write components for Fuchsia in Go or Microsoft's effort to create new features for Longhorn in .NET.
- comex 3y agoBut it's mostly replacing Objective-C code which was already not particularly fast – as opposed to the C++ or C code used more often in performance- or memory-sensitive areas. My experience with Swift is somewhat limited, because every time I've tried to use it, I've run into glaring performance issues and had to switch language. It might be reasonably performant compared to Go or .NET, but it's nothing like Rust.
- trinix912 3y agoWhat kind of stuff were you doing in Swift to notice performance issues? I've been developing macOS and iOS apps for a while now and it doesn't seem much slower than Objective-C.
- aatd86 3y agoWas probably due to FFI for Go I'd assume. Do you have a reference somewhere I can read up?
- hedgehog 3y agoMy experience was the opposite, I really like Swift but its usefulness is held back by the lack of a wider community. I'm not sure if that's due to a lack of investment on Apple's part, or maybe that it lives in an unhappy compromise between C++ and Python where there's always a more mature alternative that's good enough, but the language itself is quite nice to write.
- singularity2001 3y agoSame, I find swift so much more ergonomic and beautiful than rust, but the development story outside (and inside) of xcode is just ugly
- scns 3y agoAppCode being sunsetted by Jetbrains made me a little sad. Not coding in the Apple ecosystem anymore. Out of IntelliJ, Visual Studio and XCode, it made the worst impression on me
- frizlab 3y agoSwift is fully compatible with Visual Studio for those who prefer it. They have an official extension which works very well https://www.swift.org/blog/vscode-extension/ https://www.swift.org/blog/vscode-extension/ (Also, it’s Xcode)
- threeseed 3y agoScala is likely a big reason as well. It is the most similar in terms of language features and style but it has access to Java's unparalleled library and tooling ecosystem.
- baby 3y agoIf they had waited a little bit Rust would have been a great option. That's a shame.
- dwaite 3y agoNot really. The two are somewhat sister languages, but they have been syntax-optimized toward completely different focuses. Swift for example defaults to copyable value types and reference types that are refcounted because that is what is most often needed for evented application code, while Rust defaults to non-copyable objects (with wrappers for things like reference counting) because of its systems development focus. Swift also had a hard requirement of a decade of co-existance with Objective-C. A significant number of Swift types toll-free bridge with objc (and corefoundation) alternatives, and that had a considerable impact on the standard library. Their base library would be different from Rust's "std" due to needing different implementations of strings, vectors, dicts and so on. The two do take quite a bit of inspiration from one another, and will gradually grow to support an ever-larger overlapping set of use cases, but the design constraints of the existing language will still mean that one or the other is better for a specific task.
- o1y32 3y agoNo, that's not possible. Just one example -- In Rust/C++, developer is responsible for managing the memory, while in Java/Swift etc the language does most of the work for you. This alone can fundamentally change many aspects of language design and mean completely different experience for developers
- baby 3y agoAh I see, I didn't know Swift was garbage collected. That makes sense. EDIT: wait, I'm reading that swift does not have a garbage collector. I guess I don't see how it differs from Rust then. EDIT2: ah I see, everything's a smart pointer basically and memory's released at the end (RAII-style), whereas Rust has the borrow checker (but it's still RAII-style). I guess both implement RAII ideas, but Rust seems to do it at compile time and Swift at run time.
- masklinn 3y ago
- djha-skin 3y agoThere's not even anything technically interesting about the language. Reference counting? Really? We have so much more than that and you just went with reference counting. Ugh
- zarzavat 3y agoWhat would you use instead of ref counting? Swift is an embedded language for Apple’s own chips, they can optimize the hell out of refcounting at silicon level.
- olliej 3y agoThere really is only so much you can do - especially once you've got refcount churn on objects being used across multiple threads. Swift's refcounting can get truly annoying at times.
- pkulak 3y agoModern, state-of-the-art, generational GC? Not being snarky, that’s literally the comparison.
- zarzavat 3y agoThere was never any way to implement a modern GC while keeping compatibility with Objective-C, which was the primary design goal of Swift. Apple had a bad experience with GC in ObjC with libauto and learned their lesson that C and GC just don’t mix. You can never have a truly modern GC in C, because C cannot provide any of the guarantees that a GC needs to move objects around. Using a modern GC entails sealing the language off in a bubble. Since Swift is mostly used to interface with system frameworks, you would end up paying a cost when interfacing with the system frameworks written in ObjC, making your modern GC useless most of the time.
- olliej 3y ago> There's not even anything technically interesting about the language It's a modern statically compiled language with complex generics, that supports providing a generic interfaces in libraries with retaining ABI compatibility. Which no other modern "system" language supports. That's fairly technically interesting to me. > We have so much more than that and you just went with reference counting Like what? The options for memory safe shared ownership are refcounting or GC. Assuming you're talking about rust, that's just C++: object lifetime is lexical, and if you need it to last longer you have to use Arc/Rc/shared_ptr. The purpose of the lifetime and borrow checkers is to ensure exclusive access, and reduce the copy/destruction churn that you get from the C++ model (a hypothetical C++ that only allows the use of unique_ptr instead of raw pointers - obviously C++'s type system and approach to memory safety is not a Good Thing). But it's important to realize rust did not create a new solution to object lifetime management for shared objects. It's also important to realize that rust was designed in an environment where there was no existing code to interoperate with, whereas Swift was designed to work with the existing Darwin APIs and objective-c which are all refcounted. So even if no refcounting was the goal you'd end up with a new language, designed for a specific environment, and the default behaviour would not be correct. Now that the language is more established, and it's less critical for every part of the language to have objc interop they are working on pure ownership semantics, for the same reason as rust: it saves copies without requiring a refcount[1] [1] https://github.com/apple/swift/blob/main/docs/OwnershipManifesto.md https://github.com/apple/swift/blob/main/docs/OwnershipManif...
- blululu 3y agoTotally valid point that swift is only useful for developing for Apple products, but this same criticism also applies more or less to Kotlin on Android. If you are dealing with iOS it is a joy compared to objective C. I would also add that it is a really nice language in general that is modern, expressive and general ergonomic.
- philwelch 3y agoI thought Kotlin was pretty widely used as a Java alternative on the backend
- fnord77 3y agoKotlin seems kinds of pointless with the features in newer Java versions
- d3nj4l 3y agoNo amount of lipstick on the java pig will make it as ergonomic to use by default as kotlin.
- doyouevensunbro 3y agoJust looking at Java’s upcoming string interpolation makes me so happy I moved to Kotlin years ago. https://openjdk.org/jeps/430 https://openjdk.org/jeps/430
- fbdab103 3y ago
- Grustaf 3y agoEven if it was a 100% Apple language, that would still be quite relevant. Apple's devices are pretty pervasive, especially among the well off.
- rvz 3y ago> No one outside Apple chooses Shift unless they want to build something in Apple's ecosystem. “No one” Yet The Browser Company (The one that is hyping the Arc Browser) is writing their browser in Swift to support Windows. [0] which that is their main product. The Browser Company is not “No one”. [0] https://m.youtube.com/watch?v=Xa_fNuaSE_I https://m.youtube.com/watch?v=Xa_fNuaSE_I EDIT: So this video doesn't show someone choosing Swift outside of Apple and using on a different platform (Windows) and doesn't disprove the claim of "No one outside Apple chooses Swift"? Surely you can do better than some of the very low effort replies below.
- ohgodplsno 3y agoThe Browser Company is absolutely no one. They're barely more influent than me creating a repo on github, and that kind of impact is pretty damn low as is. They're a 0.000% browser share company that runs a tight marketing campaign of only inviting tech influencers to their browser. Mind you, said browser has good ideas, great ones even. But overall, they're absolutely no one. iOS/macOS devs use Swift on other platforms because it's the only language they know, yeepidodadey. Ignore the fact that 99% of their project is cinterop with Chromium
- iknowstuff 3y agoThe who
- olliej 3y agoYet another chrome wrapper, but with VC funding.
- rvz 3y agoAnd? Brave (VC funded) is also a Chromium wrapper and Edge (Microsoft owned) is also one as well and both of the somehow managed to beat Firefox in usage. So what is you point? Chrome and its derivatives is the reason why browsers like Firefox is failing to keep up and continues to lose users. Using anything other than Chrome for a modern web browser is a losing battle. (Brave already tried that with Firefox and quickly switched to Chrome)
- brundolf 3y agoYou're saying two things as if they're a contradiction, but they aren't It's valuable to Apple to have a language perfectly tuned to their stack, as the official entrypoint to all their APIs. If you need to use those APIs, you're excited about Swift. If you don't, you aren't
- deanCommie 3y agoWho outside of Apple is using Objective C? That's like...Apple's whole deal. Proprietary everything top-to-bottom.
- jb1991 3y agoWhile it’s true that the language is really only useful on just Apple platforms, it is still quite an amazing language. I have professionally used about half a dozen languages over the last many years, written hundreds of thousands of lines each in all those languages, and swift is a true breath of fresh air. It checks all the boxes for me, very concise and elegant to write, yet very strictly statically typed. A nice upgrade to OO programming with use of protocols, with strong encouragement to use functional programming here and there as well. Runs reasonably fast, on par with Go or Java. Overall just really nice ergonomics. named parameters and a wide variety of other seemingly minor syntactical characteristics act as a meaningful upgrade to make the overall process of writing code much more enjoyable for me. The fact that Apple provides all these incredible platform specific frameworks and libraries for graphics, audio, games, GPU kernel programming, and more, it’s just the icing.
- ohgodplsno 3y ago>Runs reasonably fast, on par with Go or Java. Having to deal with weakself, no reference cycles, very limited closures, having to deal with Xcode, no integration with any other IDE because Apple Apples, debatable generics, SPM, debatable cross platform abilities, fucking Tasks and Actors, SwiftUI being locked to versions of Swift, extremely limited community, few high quality open source libraries for something that only performs as well as Java is quite the hard sell. For that price, you could also get Kotlin which fixes most of Java's problems and provides access to all the JVM as well as Kotlin/Native, with top tier DSL abilities and a really well thought out stdlib, coroutines, reified funs and much more.
- frizlab 3y agoThis comment is of very low quality. I agree with pretty much _nothing_ with it (and tbh most of it feels like trolling), but I’ll just comment on the thing where it’s obviously plainly wrong: no other IDE. Swift has LSP integration, and has an official extension for VSCode, which works very well. They even have a blog post about it https://www.swift.org/blog/vscode-extension/ https://www.swift.org/blog/vscode-extension/
- thrwawy74 3y ago
- pjmlp 3y agoThe same appeal as .NET on the Windows ecosytem, Objective-C on NeXT/OS X, Java/Kotlin on Android (plenty of stuff that is Android only beyond the basic standard library, C++ OS specific SDKs,.... Many people are more than happy to do all their career on a specific platform.
- napierzaza 3y ago[dead]
- _the_inflator 3y agoYou got a point. On the other side, arguably, one could say the same about C#, JavaScript or Python. It took real effort from Microsoft into the Open Source space to make it more widely popular. Far away from Java or JavaScript, but I see many similarities between the development and evolution of Swift and C#. Almost everything starts as a domain specific language. Same goes for JavaScript. First browser only, then through Node, suddenly JavaScript everywhere. Python gained massive traction through Jupyter. Before that, I found Python a clumsy alternative to JavaScript. Since then I have changed my mind. ;)
- scns 3y agoPython came preinstalled on pretty much every Linux box before Jupyter IIRC.
- awestroke 3y agoThe appeal of swift is that it is lightyears better than ObjectiveC. To ObjC developers that are used to being treated like trash by Apple (abysmal documentation, stone age IDE and tooling etc) that's huge
- lapcat 3y agoApple's documentation was actually vastly superior before Swift. In fact, I often refer to the documentation "archive" instead of the latest docs. The decline in the docs is due to a number of factors, but I would say mainly it's (1) the relentless annual major OS update schedule, (2) the proliferation of OS (macOS, iOS, watchOS, tvOS, xrOS?), (3) the dual language stack, (4) Apple personnel turnover.
- spacemadness 3y agoApple seems to abuse the fact that people make a living translating the lack of documentation into online courses, books, and articles. The market for this is an ongoing enabler at this point.
- sumuyuda 3y agoLol, Apple is still treating developers like trash, just a new language now.
- iainmerrick 3y agoWhat’s changed there? I do quite like Swift overall -- it’s usually terser than Obj-C and I like the much stricter and more expressive type system. But you pay for that with much longer compile times, and the tooling feels much the same (Xcode is still Xcode).