223 points · by nostrademons · 10y ago · 115 comments
The only part that frustrates me is that SourceKit seems to crash every other minute for no apparent reason - but that is no fault of the language itself.
Swift is the first piece of Apple software I'm genuinely excited for. Congrats to everyone who contributed to the 2.2 release
There's a way to dance around that restriction, by making an intermediate class to do type erasure by hand (why I should do that? That's compiler's job), but still - Swift crew are obviously very talented bunch with a good taste, how they allowed such nonsense from the start?
PS I don't want to sound too negative, Swift replaced C# as my favorite language, 95% of the time it's joy to use (especially after Objective C, I never agreed with that language), it's just - the generic protocol thing drives me mad.
e.g.? I've only just scratched the surface of Rust and dismissed C# as a Java clone (but maybe I shouldn't have?). What's some examples of the best of Swift that you see?
Generics were a cutting-edge feature in 2005. Microsoft took the opportunity to start from scratch, and released the .Net Framework 2.0 without backwards-compatibility, and with full support for generics. A List<String> is actually a List of String.
When Sun released Java 5, they didn't want to disrupt the established Java ecosystem. Their implementation is called "type erasure". As an example, List<String> is actually just List<Object>, with automatic runtime typecasting to String. https://docs.oracle.com/javase/tutorial/java/generics/erasur...
Java's solution works well enough, but it breaks down in certain scenarios, such as multiple levels of generics. For example, when getting an element from a List<List<String>>, Object is not cast to List<String> (which doesn't really exist), but merely List.
C#'s implementation of generics became even more sophisticated with C#4, which introduced covariance and contravariance. https://msdn.microsoft.com/en-us/library/ee207183.aspx
I was already using C++ templates in 1994 with Borland C++ for Windows 3.1!
Ada, CLU and ML go back to the late 70's / early 80's.
Generics have been around since at least the early '80s.
But most importantly to me, Swift is composed in such a way that it just 'clicks' for me, ie many times many times I can guess how something is likely called or how it will behave without looking at the docs and I have a solid chance of being right - that 'intuitiveness' is something that is lacking in many other languages I've used over the years.
In regards to C#, by now it is definitely not just a Java clone anymore, in particular saner type system and much more functional features edge it for me over Java, plus the speed of evolution is much greater in the C# land. If you want to see how C# and Java differ but are tied to the JVM, try Kotlin: http://kotlinlang.org - it's fairly similar in feel to C# and has 100% Java compatibility.
IntelliJ absolutely trounces VSS and some combination of Spring Boot, DropWizard or Vert.x blows ASP.NET MVC away. Not to mention the whole ecosystem is a hell of a lot more open. There is a library for just about anything under the sun.
It definitely looks like that, but I'll take C# over Java any day
Java API looks like it was built by the worse bureaucrats they could find and one piece doesn't fit another except in a very specific (non-obvious) way
https://github.com/apple/swift-evolution/blob/master/proposa...
https://github.com/apple/swift-evolution/blob/master/proposa...
https://github.com/apple/swift-evolution/blob/master/proposa...
https://github.com/apple/swift-evolution/blob/master/proposa...
I just spent a while reading about both stride and for ... in, and I feel like there are any number of cases where I would rather use a C-style for loop.
for i in range(10):
instead.
Could you use a while loop instead?
I feel like (as long as the numerical case optimizes to the same thing) the for-in loop (and occasional use of the while loop) is clearer.
In Swift 3.0 they'll remove the deprecated syntaxes.
This only exists for objective-c introp, and the creators are actively trying to find ways to get rid of it. On the other hand, in nearly every other language, all pointers would be considered implicitly unwrapped optionals, while in Swift you get optionals built in (food for thought).
>awkward syntax where you need exclamation marks all
Oh come on, syntax does not define a language. If they used a different character or an operator, would you be more happy? Either way, it does take some getting used to but eventually it feels natural.
>insanely complicated use of enumerations
What?! This is one of my favorite features! You can represent so many things with an enum and it can make your code much safer. My favorite two examples are representing JSON as an enum, and the fact that Swift's Optional is actually just an enum with cases .none and .some(T).
>basic string operations such as doing a substring are unnecessarily complicated and verbose
I somewhat agree with you on this. They have their reasons (mostly because strings can have varying sizes, so indexing a utf8 string, for example, can give unexpected results) but I still wish they did something about it.
> error: opening import file for module 'SwiftShims': No such file or directory
Apparently the problem with GCC ABI break hasn't been tackled yet.
https://bugs.swift.org/browse/SR-23
As info, the only workaround is to rebuild Swift from scratch.
I’m thoroughly convinced that Apple has an internal-only IDE that they use that is far better than Xcode and is actually functional, much like the internal Radar tool. There is no way Apple’s engineers could get any work done if they use Xcode.
Or, they should start charging money for it so they could justify spending resources on the dev tools. One of the reasons (among many) that Visual Studio is still the king of all IDEs is because Microsoft charges money for the serious bits of it (Pro and higher).
That's an interesting point and it makes a lot of sense. With the scale of the codebases a lot of them are working on I also don't see how they could be productive while working in XCode. And also XCode could not be this buggy and broken if it had internal developers working with it and constantly reporting bugs.
personally, I'm the kind of guy with a "vim 4 life" tattoo, so I don't really know why people put up with crappy IDEs...
I've never liked Visual Studio, and the last time I worked on a serious Windows product most of the experienced developers used WinDbg and cordbg rather than the neutered Visual Studio debugger. And some guys still wrote their code in Visual Studio 6 rather than the newer .NET IDEs.
My problem with Xcode today is that it's too much like Visual Studio. I'll take Xcode 3 with LLDB any day.
Xcode for iOS and Mac development has been the most productive IDE I've used professionally, not without its flaws, and unintuitive nuances, but continually improving. Yearly major ticket feature additions like UI Unit testing shows me Apple is still heavily investing in developer tools.
I'm sorry, but LLVM?
Yup! They're free! I have found Apple's developer ecosystem to be fantastic overall.
You mean by still not being able to provide an working experience to the NDK users, three years later?
Or by redoing their plugins for Android Studio 2.0, forcing devs that rely on something stable to still be on Android Studio 1.5?
Also by having each release be a bug party that make people at /r/androiddev/ wonder if they ever test what they release?