UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

Were there changes between the first Swift beta and release?

Recorded – watch the full episode on YouTube.

A lot of changes happened between beta 1 and Swift 1.0. And one of the most notable ones was the array reference type value types semantic changed dramatically. Was that also planned? Was that based on the very extensive community feedback in the early days?

Chris Lattner: I think that's probably one of the biggest, most controversial and most difficult management/technical challenges we faced. Actually, before I go into that, between Swift beta one and one 1.0 GM there's a whole bunch of features. Some of them were planned: access control, public and private – that was planned to go in for 1.0. It didn't make it for beta 1. I believe that was actually in the very first release notes for Swift 1.0 beta.

"In 1.0 beta, arrays did not have value semantics. Everything else did. Dictionaries did, strings did, integers and floats of course did, but arrays didn't. And this came about for a very hard rock and a hard spot reason, which was we had decided that value semantics were the right way to go."

But you bring up a really, really interesting one, which is in 1.0 beta, arrays did not have value semantics. Everything else did. And so dictionary did, strings did, of course, integers and floats of course did, but arrays didn't. And this came about for a very hard rock and a hard spot reason, which was we had decided that value semantics were the right way to go. Dave Abrahams in particular was very adamant that this was the right way to go. He made very convincing argument. The dude is super smart.

On the other hand, we care about performance. And so we had to launch, and one of the claims that we wanted to make at launch was that Swift is actually fast. Unfortunately, we didn't have the ARC optimizer. We didn't have a lot of other things we knew we could build, but they had not come into place yet, and array performance is really important. It was coming down to the wire, and there was no way to get performance where we wanted it to be.

"We launched and one of the pieces of feedback we got was this made no sense. And on the one hand we knew that, but on the other hand, hearing it from a real developers made it very visceral. I think that motivated me, that also motivated the folks working on the optimizer and really led us to push that."

I take responsibility for this. I made the call of saying we won’t have value semantics for arrays, so here's this weird half measure that kind of makes it work. It was awful. I'm not going to defend it. It was highly controversial with the team. People were almost going to murder me. But we really didn't have a good choice there. It doesn't make sense to launch a language called Swift, if it's actually brutally slow.

So, we launched and one of the pieces of feedback we got was, this made no sense. And on the one hand we knew that, but on the other hand, hearing it from a real developers made it very visceral. I think that motivated me, that also motivated the folks working on the optimizer and really led us to push that. Also, the extra three months worth of time really helped close that and so by the time we launched, we got arrays value semantics and I am so happy we did. Dave was completely right.

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 RevenueCat

SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure your entire paywall view without any code changes or app updates.

Learn more here

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

BUY OUR BOOKS
Buy Pro Swift Buy Pro SwiftUI 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 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 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.