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.
jb1991|2 years ago
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.
mpweiher|2 years ago
How exactly are protocols a Swift "upgrade" to OO programming? They were in Objective-C since the mid 90s, adopted by Java as interfaces, copied by C# etc.
Also, protocols in Swift have a huge performance downside, because they decided to have them work across structs and classes: if you use a protocol in a function argument, the compiler doesn't even know the size of the argument at compile time, so copying the arguments has to be dynamically dispatched unless the compiler can figure it out in an extra optimisation pass...that's not possible when doing separate compilation.
> Runs reasonably fast, on par with Go or Java.
A downgrade...particularly considering the epic compile times.
> named parameters
Also there since the 80s, in a less weird way.
https://blog.metaobject.com/2020/06/the-curious-case-of-swif...
> ...professionally used about half a dozen languages ...
What languages were those, if I may ask?
ohgodplsno|2 years ago
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.
thrwawy74|2 years ago
shagie|2 years ago
2016: https://9to5mac.com/2016/02/22/ibm-swift-cloud-kitura/
2016: https://www.infoq.com/presentations/swift-server/
2020: https://www.infoq.com/news/2020/01/ibm-stop-work-swift-serve...
You can run it in docker: https://hub.docker.com/_/swift
awill|2 years ago
yieldcrv|2 years ago
for now
just saw an article about IBM deleting most of their website because its a mess. It was some linkedin developer's post.
hedgehog|2 years ago
singularity2001|2 years ago
threeseed|2 years ago
It is the most similar in terms of language features and style but it has access to Java's unparalleled library and tooling ecosystem.
lyu07282|2 years ago
pilif|2 years ago
The standard library is becoming cross-platform as we discuss it here.
nequo|2 years ago
Is it just that the maintenance cost is not worth it? Or would it threaten its ecosystem in a way that I don't understand?
It would seem that making Swift cross-platform would make Apple's ecosystem more accessible to developers. The barrier to entry would be lower if developers only needed to learn the APIs and not a whole new language and its tooling too. This would help the ecosystem stay healthy for a longer time.
blululu|2 years ago
Illniyar|2 years ago
It was JetBrains pet project to fix archaic stuff in Java without making a Scala. It was designed from the get go for a wide base (as wide as java).
I'm not sure how it became Android's main target, but I doubt it was the original purpose.
chii|2 years ago
i think kotlin has more use outside compared to swift.
But a language has to start somewhere, so i wouldn't hold it against swift. It's a fairly well done language regardless, and nothing apple specific about it tbh (which are all just libraries).
philwelch|2 years ago
stevefan1999|2 years ago
GeekyBear|2 years ago
It's like Rust in that it offers memory safety by default without a big performance hit.
kitsunesoba|2 years ago
cellularmitosis|2 years ago
You might be surprised (I was). Most of the benchmarks I’ve seen place it more in the neighborhood of golang and v8, rather than the C, C++, rust neighborhood you might expect.
Another commenter in this thread highlighted that the ref-counting GC is what keeps it out of the C / Rust performance neighborhood.
kevingadd|2 years ago
vxNsr|2 years ago
[0] https://arc.net/
_the_inflator|2 years ago
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|2 years ago
29athrowaway|2 years ago
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|2 years ago
carbocation|2 years ago
rvz|2 years ago
“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
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|2 years ago
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|2 years ago
Grustaf|2 years ago
brundolf|2 years ago
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
pjmlp|2 years ago
Many people are more than happy to do all their career on a specific platform.
napierzaza|2 years ago
[deleted]
baby|2 years ago
masklinn|2 years ago
And not at all compatible or easily bridgeable with obj-c, which was not optional.
dwaite|2 years ago
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|2 years ago
irrational|2 years ago
deanCommie|2 years ago
That's like...Apple's whole deal. Proprietary everything top-to-bottom.
awestroke|2 years ago
lapcat|2 years ago
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.
iainmerrick|2 years ago
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).
sumuyuda|2 years ago
djha-skin|2 years ago
olliej|2 years ago
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/OwnershipManif...
zarzavat|2 years ago
brink|2 years ago
blululu|2 years ago