4 ms·
I feel differently. I read the docs when it was first released and felt it was potentially hitting the sweet spot for "static yet expressive" and "familiar yet
by andybak 7y ago
I feel differently. I read the docs when it was first released and felt it was potentially hitting the sweet spot for "static yet expressive" and "familiar yet modern". I was mainly Python at the time and the readability and clarity impressed me and those are areas where I have very high standards.
More radical languages all tend to look a bit "read only" to me but I am aware that might just be unfamiliarity on my part.
C# and Kotlin both have nice features but they are more conservative Java-likes than Swift. Swift had enough modern features and syntax to feel like it would be reward the effort learning.
But I don't own an iOS device so I'm still waiting for a use case!
- pjmlp 7y ago.NET and JVM also have Clojure, Scala, F#, C++ to choose from, metaprogramming runtimes, and AOT compilation support (although many seem to forget about this one). So while Swift is a welcomed improvement over Objective-C, hardly brings anything worthwile to dump either the Java or .NET ecosystems.
- DeathArrow 7y agoAdd the fact that both JVM and NET are huge ecosystems with tons of libraries.
- ChrisMarshallNY 7y agoI use Swift to write for all Apple systems (iOS, Mac, Watch and TV). The only ones that are similar are iOS and TVOS, but there's a few differences in the way that you structure apps.
- lmm 7y ago> C# and Kotlin both have nice features but they are more conservative Java-likes than Swift. Swift had enough modern features and syntax to feel like it would be reward the effort learning. What does it have that Kotlin doesn't? (As a Scala programmer, Swift and Kotlin look pretty much the same to me; as far as I can see they're both polished but conservative languages that don't fundamentally offer anything that wasn't in OCaml)
- dep_b 7y agoThey're pretty similar on the surface but Kotlin is a bit hindered by it's Java legacy, generics are better in Swift (and for example C#) because of that. Swift has associated values with enums, Kotlin can assign a value to a variable with a when (switch) statement. Swift uses more pass by value, Kotlin does a lot more pass by reference. Kotlin has Java's form of garbage collection, Swift uses ARC. ARC is simpler to predict but can induce a performance penalty. I don't think Kotlin has any form of the "ugly C" API Swift has. Swift is a bit more secure in terms of "it compiles, it works" than Kotlin, but Kotlin is definitely a huge improvement over Java.
- lmm 7y ago> generics are better in Swift (and for example C#) because of that Disagree. Reified generics let you write functions that do different things based on the runtime type of an object, but such functions are confusing to a reader and best avoided. > Swift has associated values with enums Java/Kotlin style enums are my favourite from any language, since they're first-class objects; you can give them a value in a field if that's what you want, but you can also have them implement an interface etc. > ARC is simpler to predict but can induce a performance penalty. In the general case ARC has the same pause problems as traditional GC, since you can't tell when one reference is the last living reference to an arbitrarily large object graph. > Swift is a bit more secure in terms of "it compiles, it works" than Kotlin How so? If anything I'd have expected the opposite.
- saagarjha 7y agoEnumerations can satisfy protocol requirements in Swift; they're first class.
- lmm 7y agoFair enough. Looking into it, swift's "associated values" sound super weird; it seems like it means you can have multiple distinct instances for the same enum case, which breaks what I'd expect an enum to be. In fact an enum with associated values sounds more like a sealed class - both those concepts exist in Kotlin, but they're different and the difference is useful.
- DeathArrow 7y ago>C# and Kotlin both have nice features but they are more conservative Java-likes than Swift. Swift had enough modern features and syntax to feel like it would be reward the effort learning. What necessary modern features do you feel Swift has and C# doesn't?