36 ms·
I love Swift dearly - I spent two years in Objective C land, after 8 years of C# and 10-ish years of C++ pain, and started using Swift day to day from Swift 1.2
by apetrovic 11y ago
I love Swift dearly - I spent two years in Objective C land, after 8 years of C# and 10-ish years of C++ pain, and started using Swift day to day from Swift 1.2. But the current version have one big gaping hole: generic protocols are utter shit. For the uninitiated: Swift generic protocols don't have generic parameters, they have type constraints. Which means that a function can't return generic protocol. Which is the stupidest thing ever.
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.
- AsyncAwait 11y agoYeah, somewhat related to that; it's not currently possible to have typealias for a type with generic parameters, one has to wrap it in a struct or an enum, however Swift is very much not done and they're catching up quickly, so I'm optimistic, especially now that we can see and affect what's coming next.
- melloclello 11y agoGeneric typealiases are coming, thank goodness: http://ericasadun.com/2016/03/08/generic-typealiases-are-a-thing/ http://ericasadun.com/2016/03/08/generic-typealiases-are-a-t...
- AsyncAwait 11y agoAwesome! This is what I'm talking about; now that Swift is open-source we can see which improvements have landed and what is coming next. Thanks for the link.