NEW: Start my new Ultimate Portfolio App course with a free Hacking with Swift+ trial! >>

If you were starting from scratch today, what would you do differently?

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.

Listen on Apple Podcasts

Hacking with Swift is sponsored by Stream

SPONSORED Check out Stream's cross-platform open source chat SDK on GitHub! Write once and deploy your app with fully featured chat UI on iOS and macOS.

Go to GitHub

Sponsor Hacking with Swift and reach the world's largest Swift community!

BUY OUR BOOKS
Buy Pro Swift Buy Swift Design Patterns Buy Testing Swift Buy Hacking with iOS Buy Swift Coding Challenges Buy Swift on Sundays Volume One Buy Server-Side Swift (Vapor Edition) Buy Advanced iOS Volume One Buy Advanced iOS Volume Two Buy Advanced iOS Volume Three Buy Hacking with watchOS Buy Hacking with tvOS Buy Hacking with macOS Buy Dive Into SpriteKit Buy Swift in Sixty Seconds Buy Objective-C for Swift Developers Buy Server-Side Swift (Kitura Edition) Buy Beyond Code

Was this page useful? Let us know!

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.