< How did you decide what went into Swift at launch? | How did Swift change the landscape for developers? > |
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.
SPONSORED Debug 10x faster with Proxyman. Your ultimate tool to capture HTTPs requests/ responses, natively built for iPhone and macOS. You’d be surprised how much you can learn about any system by watching what it does over the network.
Sponsor Hacking with Swift and reach the world's largest Swift community!
Link copied to your pasteboard.