|< How important were Playgrounds and the reference guide?||Should someone learn Swift as their first language? >|
Recorded – watch the full episode on YouTube.
If you're starting to develop Swift from scratch today, what would you do differently this time?
Chris Lattner: Well, I think that Swift is not done yet, so there's a lot of things. It's a little bit too early to say, okay, let's throw this one away and try a new one, right? I would like to see some of the concurrency features and some of the other changes. Like maybe regular expressions some day. There's certain things that need to happen. But I think there are clearly mistakes in Swift.
I think that pushing harder on making statements be closure based expressions is one of those things that is fairly profound that I think would have eliminated a lot of complexity from the language. And now we're seeing a lot of things to try to work around that.
"I think the initialization syntax in Swift, so the convenience initializers, delegating, all that kind of stuff, is very complicated and that was required because of Core Data and Objective-C patterns."
You see that in SwiftUI where there's like the
ForEach view, for example, and it doesn't feel really native. And that's because there's this big divide between what are expressions and therefore hackable in the library versus what are the built-in statements. And I think that going all the way would have been better.
There's other minor things, particularly in the standard library there are some methods that can be named better. I think the initialization syntax in Swift, so the convenience initializers, delegating, all that kind of stuff, is very complicated and that was required because of Core Data and Objective-C patterns and things like that and so there are pieces like that that could be way simpler if you don't care about compatibility.
"I think that Swift is kind of midway through its evolutionary arc and I don't think it's quite to the stodgy old cannot change world. I think that there's still a lot of room to improve."
Overall I think that the premise has worked out well and so there are things in the compiler that can and should be very different someday when we all get the chance to rewrite the compiler but I don't think that that necessarily requires replacing the whole language. So I think that Swift is kind of midway through its evolutionary arc and I don't think it's quite to the stodgy old cannot change world. I think that there's still a lot of room to improve.
Paul Hudson: I actually saw a tweet yesterday from Harlan Haskins who said that he thinks there are only two people who understand Swift's initializer rules fully and they both work on Swift.
Chris Lattner: Probably true. It's definitely not me.
Paul Hudson: There you go, folks. Whoever felt lost with Swift initializers, don't worry. You're not alone. We all feel the same way.
This transcript was recorded as part of Swiftly Speaking. You can watch the full original episode on YouTube, or subscribe to the audio version on Apple Podcasts.
SPONSORED From August 2nd to 8th you can join a FREE crash course for mid/senior iOS devs who want to achieve an expert level of technical and practical skills – it’s the fast track to being a complete senior developer!
Link copied to your pasteboard.