0:00:00All right, how are we starting this? I didn't... You're starting it. I'm starting it. Okay. You're the host, man. All right. Well, here we go.
0:00:04All right, so hey everybody, we're doing something extremely special today and I am
0:00:11genuinely exceedingly excited about it. And so I teased last episode that we would have a little
0:00:16surprise coming up and a little treat is I think what I called it. And it's actually more than a
0:00:20little treat. It's a big treat. So today we have a special guest, but not one special guest. We have
0:00:26two special guests. So here we have today Ben Cohen, who is Senior Software Engineering Manager
0:00:31for the Swift team and Holly Borlow, the Swift Language Engineering Manager. We are in the
0:00:36presence of greatness and I don't know how we ended up here, but I'm happy about it. So thank
0:00:41you Ben and Holly for being here. I know I speak for all three of us and saying we are extremely
0:00:45excited and lucky. So thank you. Thank you very much for having us on. Of course. We interview
0:00:49interviewees very often. So, well, and actually just this morning I was watching your video,
0:00:53which was very good. We'll talk about that. But I guess, Holly, if you don't mind, if you would
0:00:58mind starting, would you give me the nickel tour of who you are and what you do? I mean, I know,
0:01:02but not everyone knows. So who are you and what do you do for Apple? Sure. Yeah. My name is Holly.
0:01:07I'm the Engineering Manager of the Swift Language team. Like you just said, my team focuses a lot on
0:01:13the user-facing language features like the generic system, type inference, and this year our major
0:01:18focus has been the concurrency model and specifically data race safety and Swift 6.
0:01:23Before I joined the Swift team, I was a Swift programmer working on Xcode. And before that,
0:01:27I was a computer science student at the University of Michigan. That's incredible. And Ben? Yeah. So
0:01:32my name is Ben Cohen and I manage the Swift team overall. So that includes the language,
0:01:36but also the backend, the optimizer, a lot of the tooling that goes around the language like
0:01:41code completion and things like that. At Apple, about eight years, I've worked on various parts of
0:01:47the Swift compiler, including the standard library, the optimizer. And before that,
0:01:51I was not a compiler engineer. So I was actually working in that sort of FinTech type stuff.
0:01:55So I'm going to really make Jon happy. I'm going to jump right to the end.
0:02:02We're not doing follow up then? No, we're not doing follow up this time.
0:02:05Well, I guess a real-time follow up. How did you end up-- and I'm asking both of you, but Ben,
0:02:10since you most recently spoke, we'll start with you. How do you end up being a compiler engineer?
0:02:13Because my perspective as a Swift developer is there's people like me who kind of know what we're
0:02:18doing. And then there's compiler engineers who really know what they're doing.
0:02:22It's like a priesthood where you're a programmer and you write the thing. But then if there's
0:02:26something wrong with the compiler, you're like, oh, it's not my fault. There are people in an
0:02:30ivory tower somewhere that make this work. And they're crossing over that path. I know there's
0:02:35lots of advertising for job positions that you don't need compiler experience. Just come be on
0:02:38the team. We'll teach you. Well, that is true. You do not need compiler experience. And in fact,
0:02:42I think actually neither me nor Holly had direct compiler experience before joining
0:02:47the Swift team to work on the language. Does it have a high tolerance for pain?
0:02:51Actually, I came to Swift through pain from other languages.
0:02:57That is such a good answer. That is so good. You sure you're not in PR?
0:03:01So my love for Swift comes from the fact that I have experienced what other languages have to
0:03:07offer. And I've always been the language enthusiast. And so whether it's Java or C++ or higher level
0:03:15languages like Ruby or Perl, there's something great about all of these different languages.
0:03:20But I always felt historically like these languages had compromises. They were either
0:03:24a little bit too slow because they were more dynamic and scripting based, or they were unsafe
0:03:29like C++ or really hard to comprehend like C++. It's a true story.
0:03:34And my background is actually I used to work on trading systems. And performance is really
0:03:40important in trading systems. And so we used to do a lot of things in C++. But at the same time,
0:03:46safety is really important in trading systems. You do not want the machine to do the wrong thing.
0:03:50And so we always used to have this trade off between like C++ and Java. And when I saw Swift
0:03:5710 years ago now, I was actually blown away by the fact that it actually managed to find the
0:04:03sweet spot between those different things. It was deterministic. It didn't have a garbage collector.
0:04:07But also it had that higher level feel. It does sometimes look a lot more like
0:04:11sort of the Ruby-like language where it's really joyful to program in. And it's really great to see
0:04:17that realized in things like Swift UI where it brings back that joy of programming that I think
0:04:21sometimes we lose a little bit. And so that was what brought me to Swift. And I joined Apple
0:04:25originally. I was actually a library developer. So I didn't have that background in compilers,
0:04:30but I did have that background in writing algorithms and data structures and things
0:04:33like that. And that was a really nice route in. And from that, I learned about compiler performance.
0:04:38And from that, got more into the general language design. And that's how come I ended up here.
0:04:43And then Holly, you said you started working in Xcode. Is that right? And then kind of
0:04:47meandered from there. What was that story like? Yeah, that's right. So I actually signed up for
0:04:52a mentorship program that the developer tools organization offered. And they deliberately
0:04:57paired mentees up with mentors from different parts of the organization so that you could get
0:05:03to meet people who you didn't work with on a day to day basis. And I got paired up with a Swift
0:05:07compiler engineer. And that sort of sparked my interest in actually joining the team. So for me,
0:05:13I feel like I became a compiler engineer by accident. What brought me to developer tools at
0:05:18Apple is I was really interested in education for programming. I also ended up studying computer
0:05:23science sort of by accident. I didn't go into university knowing anything about programming
0:05:28or computer science like a decade ago today. You know, it's Swift's 10 year anniversary.
0:05:3310 years ago, I knew nothing about programming. I was graduating high school, set to study dance
0:05:40at the University of Michigan. And engineering was sort of my backup and all engineers have to
0:05:45take a programming class and I really enjoyed it. And that, I think, for me really showed the power
0:05:52of making Swift or not Swift, making programming more approachable to people who weren't exposed
0:05:58to that previously. So I thought working on developer tools was a good way to do that. And
0:06:05that was how I started to learn Swift when I joined the Xcode team. The part of Xcode that I
0:06:10worked on had just been entirely rewritten in Swift. So yeah, it was this series of opportunities
0:06:17that led me to really becoming interested in working on the Swift language itself. And now
0:06:21this is sort of the ultimate opportunity to make programming more approachable to people who have
0:06:27an idea and are interested in bringing that to life through code. I love that. And I'll throw Marco
0:06:34under the bus with me because I can tell you that Marco and I went to school for CS and computer
0:06:38engineering and I cannot fathom a situation where engineering is like my fallback. Like, oh,
0:06:43I'm sure I'll be fine in engineering if this other stuff doesn't work. That's incredible.
0:06:47I just couldn't dance. That was my problem. I think I'll hear stories like an afterschool
0:06:51special of how you can slippery slope into the seedy world of compiler engineering.
0:06:55You start out as a promising dancer, but somehow the compiler people got her. And now look at her.
0:07:00Now I'm going to continue to make Jon upset by continuing to be at the bottom of the document,
0:07:04but I promise Jon, I will come back up to the beginning.
0:07:07At least you're in the, I'm about to ask him if he's not even in the documents.
0:07:09You're doing great. We have a structure. We're sticking to it.
0:07:11Well, this is our structure, despite what Jon said.
0:07:15It's not copyable. Jon, have you heard the show?
0:07:17Right. So Ben, you were very rightfully, in my opinion, slagging on C++ just a few minutes ago.
0:07:25Guess what the Swift compiler is mostly written.
0:07:27Well, that's exactly what I was going to say. So last I remember hearing,
0:07:30the Swift compiler, the last I looked, the Swift compiler is largely, if not entirely, C++.
0:07:34So you're pointing at me, wait, wait, there's more. So tell me, is there more?
0:07:39There is more. So the compiler, I actually don't have the right percentage.
0:07:42It's actually slightly difficult to tell because if you look at the GitHub repo,
0:07:47it gives you lies because for two reasons. One is like, we have a lot of tests written in Swift
0:07:52and those shouldn't count. But also we have started the process of writing parts of the compiler in
0:07:59Swift. And that started quite a while ago now, I think maybe four years ago now. But when we do
0:08:06that, we actually, we create those bits of the compiler that we rewrite as packages. And when
0:08:10you do that, we break them out into a separate repo. So if you go to github.com/apple for now,
0:08:16soon, swiftlang/swift-driver, that was the first part of the Swift compiler that we started
0:08:23rewriting in Swift. That happened about four years ago. And the driver is basically the way into the
0:08:29front end of the compiler, right? So it's the thing that does the initial processing of your
0:08:33command lines, and it organizes the build and things like that. That was written in Swift.
0:08:37Two years ago now, we started rewriting the parser in Swift. And so that is actually part of a wider
0:08:44project called Swift Syntax, which is itself written in Swift, which is originally a way of
0:08:48just manipulating Swift code. It was a library for manipulating Swift code. And that evolved into a
0:08:54replacement for our current C++ parser. That is actually the foundation for macros. So last year,
0:08:58when we introduced macros, those are based around Swift Syntax and the Swift parser.
0:09:02We have some ongoing work that's happening at the moment to do the next layer down, which is what's
0:09:09called AST generations. So what you do is you parse the code and then you turn it into an abstract
0:09:13syntax tree. And then you have to lower that down into the underlying representation. That is
0:09:18ongoing at the moment. And once we've done the AST gen layer, we will actually be throwing away
0:09:24the C++ parser. Now that's going to be an interesting moment, because that is the
0:09:30point at which there is no way back. That is the point at which you will need a Swift compiler to
0:09:34build Swift. You know he's going to look back and then get history. It's still there, sort of.
0:09:38Well, it is actually. It's an interesting thing, because we have-- app developers sometimes point
0:09:44out that they have to wait a year or two before they can raise the minimum deployment target in
0:09:48order to use SDK features. We as compiler authors know that pain, because we cannot use the very
0:09:56latest Swift features when implementing the Swift compiler, because you have to be able to use the
0:10:01shipping compiler in order to bootstrap. So we're very familiar with that. But yeah, and then more
0:10:07recently than that, we have started writing optimizer parses in Swift. So that is actually
0:10:13using C++ interop, which is another important feature of Swift. We obviously interoperate with
0:10:18LVM, which is written in C++. And we use that to build our optimizer parses to do things like
0:10:24hoist variables out of loops and things like that. And those are now written in Swift as well. So
0:10:29we are getting there. It'll be a ways away. It's not our main goal. We don't rewrite things for
0:10:36the sake of it, even though it's written in C++. It's working. And so really, when we decide we
0:10:42want to do something where we want to rewrite a part of the compiler, we try to make it for a good
0:10:46reason. And those good reasons can be, for example, creating a macro system with a nice, friendly
0:10:52Swift API. Or when we rewrite the optimizer parses, we usually do it in order to simplify them
0:10:58and make them more effective. Yeah, so we are on that path to self-hosting.
0:11:04But it's going to feel really good when you have to delete that code, though.
0:11:07It feels very good to delete code. So, Bill, I'm not sure which one of you is more appropriate to
0:11:12answer the following. But building on that, it certainly seems the implication is there is a
0:11:16strong interest to become self-hosted. And I'm not sure I'm the best person to summarize that. But
0:11:22basically, the Swift compiler is written in Swift, right? And is it fair to say the eventual-- I'm not
0:11:27looking for a date-- but the eventual one sometime goal would be to self-host entirely, if possible?
0:11:32Is that fair to say? We don't comment on future products.
0:11:35Yeah. Well, this is not a product. This is the Swift language that is entirely open source.
0:11:40And we are perfectly liberty to comment on. So, yes, I think the ultimate goal is that the compiler
0:11:44should be written in Swift. If nothing else, it does improve the safety of the compiler.
0:11:50The compiler is not filled with segfaults. But they can happen. And obviously, rewriting parts
0:12:00of it in Swift eliminate that possibility because it's a safer language. And so that's one benefit
0:12:06that comes from it as well as bringing other features. The other benefit is it makes it more
0:12:09approachable for outside people. I mean, you were talking about working on the Swift compiler as if
0:12:13it's a very intimidating thing. But at the end of the day, it's actually kind of pretty straightforward
0:12:18code when you look at a small part of it, right? When you look at a particular optimization pass,
0:12:22you know, you can usually see pretty much what it's doing. And it's actually
0:12:25a great opportunity to get contributors involved. I know Holly's worked with quite a lot of
0:12:30people who come new to the Swift programming language as well. Yeah, we also organize a
0:12:34mentorship program called the Swift mentorship program, where open source contributors who are
0:12:40interested in contributing to various parts of the Swift project, including but not limited to
0:12:43the compiler, they sign up, they get paired with someone who regularly contributes to the compiler,
0:12:48and they work together for 10 weeks on open source contributions. And a lot of people, I find that a
0:12:54lot of people who write Swift, who are iOS developers are really interested in making
0:12:59some contributions to the compiler, just as a learning experience or better understanding,
0:13:03you know, how their code works. If you're in the depths of how, you know, type inference or the
0:13:10actor isolation checker works, it gives you a little more knowledge into, you know, how the
0:13:15compiler sees your code when you're writing Swift code. So yeah, it's a cool program and a really
0:13:20good learning experience for people who are writing Swift. And I completely agree that
0:13:25moving more of the compiler over to Swift will make contributing to the compiler a lot more
0:13:29approachable for people. Does that include the standard library? Like if someone wants to add
0:13:32a method that says first, second, third spelled out fourth, fifth, sixth, and you stop them when
0:13:37they get to 30 seconds, like that's all Swift code in the standard library. So you can contribute to
0:13:41that and say, hey, I contributed to the Swift language, but you're just making Swift methods in
0:13:44the library. So I'm curious, you know, and probably for Holly, as we go into this new
0:13:49era of Swift concurrency and data race safety and everything, Swift I think has always struck
0:13:57an interesting balance. I think it's kind of a roller coaster. Sometimes it's more successful
0:14:01than other times at this balance of being easy to use for non-experts or newbies to a language
0:14:08or just new programmers. And also having all this power behind it and having quite a bit of
0:14:14complexity behind it. And as we go into this new data race safety era, how do you strike
0:14:23that balance? You know, obviously these are some very advanced concepts and somebody might get some
0:14:28warning as they're building their code saying something's not sendable because it has mutable
0:14:32state and they might not even know what any of that means. How do you balance that with
0:14:37being approachable to new programmers or to less experienced programmers?
0:14:40Yeah, so the goal for concurrency is really similar to what we've accomplished with other
0:14:46advanced features of the language. Like the generic system is the one that I always go to,
0:14:50because from the very first lines of code that you write in Swift, you're using the generic system
0:14:55because you're using standard library types like Array or you're using frameworks like Swift UI,
0:15:00which are really heavily leveraging these advanced features to make APIs that are really natural to
0:15:06use for programmers. But you don't need to understand generics, you don't need to understand
0:15:10how it works until you're at a point where you need to use those advanced features in your own
0:15:15code. And that's the end goal with concurrency as well. For newcomers to app development or
0:15:21newcomers to Swift, when you're writing code, by default that code should be on the main actor,
0:15:26and you shouldn't have to actively think about the fact that that code is on the main actor
0:15:31until you're trying to actively introduce concurrency into your project. And at that point,
0:15:38you know, you'll be confronted when you make a mistake that can lead to a data race in your code.
0:15:41And I think that both the progressive disclosures is the way to make that complexity more
0:15:47approachable. But I also think introducing those checks at compile time will also make learning to
0:15:56write concurrent code a lot more approachable for people who are new to concurrency in general.
0:16:01And this is a continued evolution of making concurrent programming more approachable.
0:16:05Concurrent programming is just notoriously really hard to get right. I don't know if you've ever
0:16:10debugged a data race before, for those of you who are listening, but if you have, you know that it
0:16:14can take days or even weeks. And the introduction of dispatch even was a huge step forward for
0:16:21making concurrent code easier to write. Working with dispatch queues is way easier than managing
0:16:27low level system resources like threads manually in your app. But you still have to know when to
0:16:33apply those tools to protect mutable state in your code. And with data race safety in Swift6,
0:16:38you can't get it wrong. The compiler will tell you if there's a risk of a data race in your code.
0:16:45And having to confront those concepts at the point when you make a mistake is better for
0:16:54forming a mental model of how concurrent code should be written in your project.
0:16:57So I'm really excited for people to start to learn concurrency for the first time with data
0:17:03race safety in Swift6, as opposed to I think a lot of people right now have internalized how
0:17:07to use dispatch and they've been using that for many years and now they're trying to learn this
0:17:11other like, it's not a completely different system in how you write code, but it is different in how
0:17:17you approach it and at what point you're confronted with the issues. And I think that might be a
0:17:21little bit more difficult than learning concurrency for the first time with the compiler checks in
0:17:25place to help prevent you from making mistakes. Is that how you characterize like the difference
0:17:29between the Swift concurrency and the like the predecessor concurrency systems at Apple? Like
0:17:33we've had, um, your grand sales were dispatch, the dispatch queues, NS operation queue, but
0:17:38pthreads back in the day, locks of various kinds over the years. And all of those were kind of,
0:17:45you'd have sessions on and they'd say, here's how you properly use this. Here's how many
0:17:48cues you should have and stuff like that. But it was all sort of like runtime stuff and everything
0:17:52I hear about Swift concurrency is always, we will do these checks for you at compile time so that
0:17:56it runs on, you don't have to run your thing to see if there's a problem or like audit the code
0:18:01and look over it. This is like the compiler will check it for you and make sure it's mostly okay.
0:18:06Would you say that's the big difference? Yeah, absolutely. You should be able to program by
0:18:10bumper where, um, you know, the compiler is there to tell you like, Oh no, you got this a little
0:18:14bit wrong with actionable suggestions for how to fix that code. Yeah. So you're talking about
0:18:18the progressive disclosure and like you don't have to know about this until you start introducing
0:18:21concurrency. But I feel like, uh, that's true of the Swift language if you're writing just Swift
0:18:26code, but once they have everyone else in this company makes a bunch of frameworks and those don't
0:18:30know or care about Swift concurrency for the most part. Uh, and they're in your code and you think,
0:18:36I haven't introduced any concurrency, but it's like, well, this method has a callback and it is
0:18:41cranky now. And you're like, but why I don't, I didn't make that API. It's, it's complaining
0:18:46about something that I don't understand. It's not an API that I wrote. And so you're like,
0:18:50you're faced with this dilemma of just, you stare at it for awhile. It's like, should I not use that
0:18:55API? Should I, should I, you know, like I think we've all had experience in everyone you've
0:19:00probably talked to has had experience trying to enable stricken currency in five 10. So if I,
0:19:04you know, and you set the setting and I go, you see all the warnings and you're like,
0:19:07how far away am I really? You're like, how many? And you know, and I think we've all taken
0:19:11different swings at this, like, and I've seen you both sort of counter the conventional wisdom.
0:19:15It's like, well, I'll just make everything sendable and that will fix everything,
0:19:17but that doesn't work. And so you're like, well, maybe I can just add annotations. I'll put me
0:19:20an actor on a bunch of things, but that doesn't work. And it's like, well, maybe I'll just
0:19:23sprinkle assume isolated everywhere. That's probably not the right approach. And I think
0:19:27my personal experience is I've taken like four different runs at bringing one of my apps on
0:19:31just stricken currency. And I just keep backing off and scratching my, I know there's a WWC session
0:19:35about it and I haven't seen it. My bad. It was a busy day yesterday and it's migrating to Swift.
0:19:40But I feel like that is a lot of the barrier and it's nothing to do with the language.
0:19:42It has to do with the APIs that we're using that were created, you know, decades ago
0:19:46that have their own conventions and stricken currency. And it's not wrong. It's correct.
0:19:50There is a potential for immutable state to be messed up there. And then of course,
0:19:54even in our own code, it's like, well, I use cues for this and I use locks and I'm
0:19:57pretty sure it's safe, but stricken currency says, well, that's what unchecked sendable is for.
0:20:01Yeah. But that's the whole thing. Like you don't want to go through it and sprinkle it through
0:20:05says, I'm sure this is okay. I'm sure this is okay. Like there are annotations to do that,
0:20:09but all you're doing is undercutting yourself by saying, no, I'm totally sure the code I wrote
0:20:12last year is bug free and there is no races and it will satisfy the compiler, but you haven't
0:20:17actually solved the problem. You haven't actually used the system you're saying, which is you should
0:20:20be able to write it. The compiler tells you what it's wrong. You might as well just turn that
0:20:24mode off. So, I mean, I think a lot of users find it frustrating, but it is a difficult problem. And
0:20:28I, I'm assuming, well, you tell me what you think the correct approach is. Give me the three second
0:20:33summary of the session that I didn't watch. I'll let Ben do that. It's Ben's session.
0:20:38It is. And well done for Casey for getting ahead of John and watching it already.
0:20:42So it really partly depends on what kind of frameworks you're using and it's possible that
0:20:47you're using some frameworks that, that, that make it harder or easier depending on what kind of code.
0:20:53Mac framework. Right. Oh, you're screwed.
0:20:56So for example, the UI layer we've actually, and it's worth trying the new SDK because
0:21:04at the UI layer, there's been a lot of work to indicate which parts of Swift UI also UI kit and
0:21:10the app kit are by definition always supposed to be running on the main thread. And that should
0:21:16actually, for people who've tried five 10, it's well worth downloading the newest decay and giving
0:21:20that a go. Does that also include like, I know this is a documentation issue, but often you'll
0:21:24see a thing with a callback and you have a question. It's like, what thread will the
0:21:28callback run on? And you're just like, Oh, you're just supposed to know whatever you thread you, you
0:21:31register it on. That's the thread the callback will run on, but you don't see that in the
0:21:34documentation. So you're like, well, I, I registered for this on the main thread. And when the callback
0:21:39gets called, it will probably get called on the main thread. And sometimes they take a queue
0:21:42as an argument and you just have to know that the main queue is the same as the main thread. But
0:21:45like documentation wise, I always feel like I look up one of these old app kit things and I'm just,
0:21:50it's guesswork. Right. Did you know, John, I learned this morning that there is a keyword
0:21:55there. What is it? It's a assume, assume main thread. There it is. I couldn't quite get there,
0:22:01but there's tools for this. John, as it turns out, I know, but I know that's not a tool for that.
0:22:05Right. Yeah. As soon as I say it, all it's going to do is, is you throw a runtime error when you're,
0:22:10when it finds out it's not on the main thread scenario. Right. Just dispatch it to me.
0:22:14So it, it, so assume isolated does throw a runtime error when, uh, when you're not on the main
0:22:20thread, this is actually something that a lot of good programmers are already doing, which is like,
0:22:24they put in preconditions where they, they know this is supposed to be on the main thread. Um,
0:22:28and they put in a precondition just in case they call it from somewhere else in their app where
0:22:31it's, they're getting a call from a dispatch queue. That's, that's not isolated to the main,
0:22:35uh, the main thread. And, and that can lead to trouble. Um, I think, uh, somebody was saying
0:22:40earlier, um, you know, you run your program and you find out it doesn't quite work. Um,
0:22:44as opposed to a compile time, you find out that you need to do something. Yeah. It feels like
0:22:47it's undercutting the bumper thing. Holly was saying is like, I don't, I don't want to find
0:22:50out at runtime. So every time I do assume isolated, I'm like, there's must be a better way.
0:22:54Don't use that there, man. That's not what it's for. So I would say that, um, finding out at
0:22:58runtime that your code is broken is the best case scenario under the old world, right. Which is that
0:23:04you, you, you really, you hope to find out when you run your code, right. That something is wrong.
0:23:08But what actually happens is that, um, in, uh, in some of these, uh, uh, techniques, you, you find
0:23:16out in the wild in when your program is crashing and you do not exactly know why. Um, I'm, I'm
0:23:21always amused by people that make these jokes on, on Mastodon or Twitter where they, they say like,
0:23:25they make a joke about concurrency where they jumble up the words. Um, and that's cute, but
0:23:30that is again, the best case scenario is jumbled up words. That's very benign. What's worse is like,
0:23:35you know, you crash, you corrupt user data. This is, this is no good. Um, and so, um, that's why
0:23:40a lot of people have these really great practices in, in the old world of dispatch, um, where, uh,
0:23:45they will insert like these assertions saying, I, I'm, I want you to stop me if I'm, if I'm not
0:23:50running on the main queue. Um, so I think the, the longterm goal is that we need to lift these kind of,
0:23:56um, uh, this information out of documentation. We want, want to take it out of documentation
0:24:01and put it actually in the definition of the API. It's not in the documentation now,
0:24:05so you don't have to lift it up. So, um, uh, so the, um, the benefit of putting it there
0:24:13so that the compiler actually enforces it is that you can't not have that information,
0:24:17right? The, by definition, your code, uh, does encapsulate the information about where you are
0:24:22running and how it's running. Yeah. Cause one of the things I do when flailing is like, there's
0:24:25a callback and I'm like, can I just annotate the callback as main actor? And the answer is no,
0:24:29you can't. And then, and then it's like, why is it already on always on the main thread is, is,
0:24:35you know, I figured what the error is. I'm just waiting for the framework to update with
0:24:38async calls. You don't have all the time in the world to wait. And yeah, it's, it's what it comes
0:24:43down to. Like you mentioned queues, right? So I, I, one of my apps has concurrency. I'm sorry. It
0:24:47does. Um, and, uh, I use queues and in one situation I wrote a little class and I use locks,
0:24:53the old, old style locks and pretty sure it's probably okay. Uh, but I look at that and like,
0:24:58I would like to use Swift concurrency because then I would be a feel more sure,
0:25:02but there's nothing you can do to sort of annotate or markup dispatch queues or locks. And other than
0:25:07than the reassurance of just telling the compiler, I'm pretty sure that I'm right. I would rather
0:25:11just like pull that out and re implement it with actors and so on. And that sometimes just
0:25:17seems daunting. So, um, another thing that there's a ton of Swift code out there and Swift code that
0:25:23inter operates with C based languages like objective C and C plus plus. Um, we're at the
0:25:28start of this transition to start to integrate Swift's native, safer concurrency primitives into
0:25:35these like vast code bases that are using older, you know, library based concurrency primitives
0:25:40like dispatch queues. Um, the system is designed for incremental migration. Um, so in the case,
0:25:45if you have like a class backed by a dispatch queue, there is a technique that you can use to
0:25:50turn that class into an actor that's backed by a dispatch queue. Um, it uses a fancy feature called
0:25:57custom actor executors, but the way to do it, it's only like four or five lines of code that you
0:26:01actually have to write in your own code. And what that lets you do is from your Swift code, it lets
0:26:05you use the static actor isolation, um, and not have to mess with the dispatch queue. But when
0:26:10you're interacting with API APIs that are based on dispatch queues, you can still pass the dispatch
0:26:15queue there. And then you can bridge between like the dynamic isolation in the static world with
0:26:20tools like assume isolated. That brings up another question of like a incremental adoption. I know.
0:26:25So this Swift six just came out. Um, and, uh, in the old five world, we had the little setting to
0:26:30set it on complete concurrency, whatever. I know there's a whole bunch of features in Swift six and
0:26:34new things for sustainability and everything that make it easier. But what is the, what is the
0:26:38mechanism in your project of saying like, I want, you know, is it, is it per module? Is it per file
0:26:44to saying I want the Swift six language features, but this file is not ready for stricken currency.
0:26:48What does that look like? So the, yeah, the setting is per module. So in your X code build settings,
0:26:54there's a language version setting, or if you're in a Swift package manifest, there's an API for
0:26:58setting it per target. And you, um, many people currently have that set to something, whether it's
0:27:03four, 4.2 or five. Um, so you would change that to six for the specific module that you're looking to
0:27:10migrate to Swift six. And then if you have a particular file that, um, violate some of the
0:27:16rules in ways that are really difficult for you to change, um, there are ways to opt out of checking
0:27:21in in specific areas in your project, um, using things like pre concurrency import statements.
0:27:26If it, if the issue is in an API that you're using, um, or, um, tools like non-isolated unsafe,
0:27:32if you have, for example, like a global variable that you're manually guarding with a lock or a
0:27:37queue at the point when you access it, you can use non-isolated unsafe to opt out of the compilers
0:27:42checking there. So there are a variety of tools like that to let you opt out of the checking in
0:27:45narrow situations in your code. Um, and then those are also things like handles that you can audit
0:27:50for later, um, to actually take a look at the opt-outs that you're using in your code and try to,
0:27:55um, uh, use those as refactoring opportunities to, um, rewrite some of that code to use something,
0:28:01something safer. So you're picking the Swift six as the language and that includes everything
0:28:05having to do with Swift six when you pick, no, no. So, so Swift six, the language mode,
0:28:10where you go into the X code settings and you, you say language mode of Swift six, that purely
0:28:15governs the strict concurrency checking. So the Swift six compiler that you get with the latest
0:28:20X code that has all of the new features. So I think you've made a glancing blow to, uh,
0:28:25non-copyable types. Um, those features are available. Um, new generic capabilities,
0:28:30non-copyable types are available in the Swift six compiler. You do not need to tell you,
0:28:34you would pick the Swift five language mode, but it's using the Swift six compiler to run
0:28:38in Swift five language mode. You get non-copyable types. You don't get the strict concurrency.
0:28:41That's right. And that's exactly, this is part of a journey that the entire Swift ecosystem needs to
0:28:45go through. Um, so, um, uh, being ready for Swift six, having your dependencies ready for Swift six.
0:28:51Um, there's actually a swift package index.com, uh, which is this great website. They have a,
0:28:56a tracker now that tells you which packages they are compiling that build cleanly on the
0:29:01Swift six pod. But, um, it really does depend on the nature of your program and whether your
0:29:05dependencies are now ready for Swift six, whether you want to turn on that language mode. And this
0:29:10dates back to, um, we've been doing this now since the Swift four days. So, um, uh, since we
0:29:16introduced the Swift four language mode, we've always had this source compatibility guarantee
0:29:21promise that whenever you download the new compiler, um, uh, with a couple of exceptions
0:29:26where like maybe there are a couple of issues with your code where maybe the code was like
0:29:31explicitly incorrect. Um, we always want you to be able to compile your code as is with the latest
0:29:37compiler. And then when you're ready for some breaking change, uh, there were a few in Swift
0:29:42five and obviously in Swift six, the, the, the key key change here is strict concurrency. You're then
0:29:47able to turn it on, on a per target basis. Is that like a, a, a long standing kind of marketing
0:29:53decision to tie them to the, I mean, you're just deciding that Swift six means stricken currency.
0:29:57You could have, for example, it said Swift six just means Swift six language features and there's
0:30:00some other option for stricken currency. And he said, no, we're tying, we're tying this feature
0:30:04to this number because people want the higher number. Is that like a, a sort of a, uh, social
0:30:09engineering decision or it's, it's a way of thinking about like the forward progress. I mean,
0:30:13you don't want to be stuck in this world, um, with the Python two, two to three transitions style
0:30:18thing, right? Where those were tied to, um, uh, you know, updating your compiler and then you
0:30:23couldn't get the new stuff without changing your code to adapt to the way that the new language
0:30:28works. So it's this, this way of helping engineer the ecosystem to help have this continuous forward
0:30:34progress. But at the end of the day, people also, um, you know, some people have written code in
0:30:38such a way that it won't be so easily adapted to Swift concurrency. Some people have written code
0:30:42using a lot of new frameworks, um, and a lot of, uh, async await and the path for them is actually
0:30:48pretty clean. And so we want people to be able to opt into that. Um, the choice as to whether you
0:30:53opt in or not is up to you. If you're finding that you are experiencing quite a lot of, uh,
0:30:58pretty gnarly crashes, it's probably worth considering opting in. Um, one great time to opt
0:31:03in is if actually you want to start introducing a lot more parallelism into your code, right? So
0:31:08we have these powerful new devices. They have many cores. Um, and you might find yourself with an app
0:31:14that previously was doing most of its work on the main thread with a little bit of background
0:31:17processing, but you really want to take advantage of a lot more parallelism in your code. That will
0:31:21be a great time to turn on Swift six mode in order to know that you can do those refactorings, uh,
0:31:27without fear introducing new data races. Um, so yeah, it's really up to each individual project
0:31:33to make that decision and to see how, uh, how the community is moving forward with them in order to
0:31:38to update their dependencies and then, and then take the plunge. Do you worry about like releasing
0:31:42Swift version 10 many years from now and huge code bases are still in Swift five language mode.
0:31:49Like they're using a Swift 10 compiler to run Swift five language mode because they could never
0:31:52get the wherewithal to, to go stricken currency compliant. And you're just plowing bravely forward
0:31:57here at Apple for making version after version. And they're all great, but they can never cross
0:32:00the six threshold because they can never get their code to run under stricken currency. The millions
0:32:05of lines of like dispatch queue and manually created locks. Like you worry about hindering
0:32:09your parts. You've basically made a hard gate of like, look, you're not going to be running a Swiss
0:32:13seven, uh, next year or whenever, if you can't go stricken currency and you're like, well, my reason
0:32:18I can't go is cause we have 10 million lines of, you know, manually managed locks or something.
0:32:22So, um, it really only governs a handful of things. So that is the goal is always,
0:32:27whenever we introduce a new language feature that you do not have to update to the new language mode.
0:32:31We were looking at somebody's project yesterday where they were still on Swift four mode.
0:32:35Um, and really there was not that much they were missing out on. Um, uh, so we have this longterm
0:32:41promise to always, uh, always support those, those language features, um, so that people
0:32:46aren't forced to update. Um, but like I say, most of the language features themselves are not gated
0:32:51on the language version. And so, um, really it's only one we need to take these big step forwards,
0:32:57um, that we, uh, encourage people to, to upgrade. They'd be running in Swift five language mode,
0:33:03but they'd still have access to all the new Swift 10 features, but they would feel bad about
0:33:06themselves because their number is five and you're rolling out seven and eight and nine and 10 and
0:33:11people be out. They'd look at the little gamified badge on the Swift package index and like, you
0:33:14don't have the little things as Swift 10 compliance. And I have a little star next to my package and
0:33:17you don't like, I get the language features. It's just not compliant. I also think there's
0:33:21a misconception that you need to totally eliminate all of the uses of tools like locks and dispatch
0:33:28cues in order to migrate to Swift six. I don't think that's true. Um, I think locks, I mean,
0:33:32um, Swift, the Swift six standard library includes a new, um, primitive, uh, mutual exclusion lock
0:33:38called mutex. And that is a tool that people can and should use in some scenarios in their code.
0:33:43And I know there are a variety of other lock types out there that people are currently using.
0:33:46You don't need to stop using those types, um, in order to migrate your code base to, um, the
0:33:52Swift six language mode. The same thing is true of dispatch cues. And, um, like I said, part of the
0:33:56reason why the system is built on incremental migration is because we know there's so much
0:34:01concurrent code out there that is using, um, you know, dispatch and other concurrency primitives.
0:34:07And if you had to eliminate or just totally refactor all of your code in order to migrate
0:34:12to Swift six, nobody would ever do it. Um, so I don't think you need to actually like massively
0:34:18refactor your code in order to migrate to Swift six. Though in some cases, like in Ben's talk,
0:34:22you'll see, um, a talk that he gave back in 2021, he actually took a sample app and, um,
0:34:28it was using dispatch and he went through and, um, replaced some uses of dispatch cues with actors.
0:34:33And that might make the migration, um, a little bit easier in some cases. Um, but you'll, you'll
0:34:39sort of see when, when you watch the talk, um, some of the things that are made easier by
0:34:43introducing actors in some places, but it is still possible to do it if you're using other things
0:34:47like dispatch to use. I've seen that talk. One of the challenges there is, um, uh, that doing that
0:34:53refactoring prior actually made it a lot easier to migrate to Swift six. And that's actually something
0:34:58that we'd encourage is people who have been adopting async and await and things like that.
0:35:01They will find, um, that turning on strict concurrency mode is a lot smoother for them,
0:35:05but we've also in the latest compiler, um, added a lot more affordances, um, for example,
0:35:11around not having to make your type sendable, but also be able to pass them through, uh, between
0:35:15isolation domains. Um, one of the, one, one of the challenges with writing the latest talk is that
0:35:21actually, um, I had these great examples, um, of problems that I was going to talk about and then
0:35:26we fixed the compiler. So they weren't a problem anymore. It happened like three times. It's a
0:35:30good problem to have. It's a very good problem. I mean, that brings me to the next topic. Like, uh,
0:35:34for both of you, what is it like developing Swift in the open? Because like I'm, I'm watching all
0:35:38year on Swift evolution. I see the features coming in Swift six is part of the reason I kind of backed
0:35:42off my recent attempt and like they're fixing a bunch of stuff and so if six and you see them go
0:35:46by, you see the proposals here, we're doing this thing, they're fixing the problems in your talk.
0:35:49And I see it happening all throughout the year. That's very different than most other people here
0:35:53at Apple. We, I mean, maybe some people sit down for WRC and they're shocked by Swift six, but if
0:35:57you're, if you're following the forums and watching the proposals, it's developed in the open, it's
0:36:02open source. Uh, the process of deciding what goes into it is open. There's no mystery involved.
0:36:08What does that like for you in a company where that is absolutely not true of all the other teams
0:36:12that you're working with except for maybe WebKit for WebKit, but also increasingly we're seeing
0:36:17more of this style of operating. Um, foundation now is, is, is operating in similar fashion. So,
0:36:25uh, and, and that has actually been key to the next thing that we've, uh, announced this year,
0:36:30which is that we now have this single unified foundation code base, um, across platforms.
0:36:35So the same foundation that you're running, um, on your phone and on your Mac, um, is the foundation
0:36:40code that you will be running if you were to stand up a server running on Linux. Um, and so they've
0:36:46been running, uh, language proposals, uh, sorry, language proposals, framework proposals, um, to,
0:36:53uh, to introduce new features, um, such as, uh, I think, uh, predicate, uh, which is a foundation
0:36:59type recently acquired support for regexes. And that proposal was discussed in the open. Uh, and
0:37:04then the other example, uh, I heard your, um, podcast last week where you're wondering,
0:37:10speculating about whether there was going to be a new testing framework.
0:37:13That's because I couldn't remember the name of Swift testing. That's the one I had seen. Yes.
0:37:16And yeah, so Swift testing was developed in the open. Um, it's, uh, it, it, we had some really
0:37:22great, uh, community feedback from that. Um, and, uh, so that's another place where we're, we're,
0:37:28we're doing, uh, that kind of, um, open dialogue with the community about, uh, sort of the next
0:37:32layer up of, of, of Swift framework features. Is there any like, uh, can use it as an example
0:37:38to the other groups? Like, look, we had, you have, we have a public issue tracker and people have
0:37:42problems that we could discuss them in the open and look how much more efficient it is to go back
0:37:46and forth on GitHub issues and discuss proposals. And these other groups are like sending carrier
0:37:51pigeons across the country to through seven different intermediary parties with this game
0:37:55of telephone to find one crashing bug. Like, do you ever like pitch the other groups and say,
0:37:59Hey, I mean, I obviously worked on foundation or, you know, you could, this could be you,
0:38:03you could be getting bug reports from people and communicating with them in an efficient manner and
0:38:07and fixing them. Yeah. We get a huge amount of benefit from the Swift community. I think,
0:38:12uh, when we bring ideas to them, uh, for new language features, um, we, we get this real
0:38:18time feedback, uh, where they, the people on the forums, they spot issues with what we're proposing
0:38:23that, uh, that we had not thought about. Um, and we, we iterate, uh, with them on that and we get
0:38:30a huge amount of value from getting that real time feedback from people. And so I would, I would, uh,
0:38:35I would say that's certainly been a valuable process for us. Plus you get to argue about
0:38:38keywords, the true purpose of every language. We do. We we've fallen into this mode now where we,
0:38:45we, um, this is something we've, we we've, uh, evolved as a process in the language steering
0:38:50group that, uh, that Holly and I sit on, which is, uh, we're now in this mode where we will agree a,
0:38:56uh, a proposal in principle where we talk about the fundamentals of the language proposal and how
0:39:00it's going to work. Um, and then what we say is we've agreed that in principle, and now there's
0:39:05like a free swim where everybody gets to specifically focus on the name we're going to use
0:39:09for the keyword. Um, and that has actually helped the process a lot because the, um,
0:39:14the bike shedding is a shiny thing that people immediately move towards. And so
0:39:19if we say like, let's park the park, the name discussion for now, let's talk about the fundamental
0:39:24feature. Then when we've agreed the fundamental feature and we accept it in principle, then we
0:39:27can have like a discussion about what we're actually going to call it. And I mean, I know
0:39:31that's, that's a source of contention and it's a silly argument with people, but it really does
0:39:35make a big difference in language. So I like some people look at that like switch evolution or other
0:39:39language lists and they're like, it just seems like a bunch of people arguing over like whether
0:39:42copyable should have a tilde in front of her. It should be a new keyword or like, like, but that's
0:39:47so important because those decisions you make, people live with those for decades. So you should
0:39:52like spend a month arguing about it, make it because I've seen, I've seen it change. And
0:39:55so the illusion like the original proposal will have this thing or whatever, and you'll end up
0:39:59with a different thing and it's better. You're making it better by arguing about it. I guess
0:40:02people just don't have a tolerance for it. They think, oh, that's not important. I don't care
0:40:04what the word is called, but it makes such a big difference to the language. And you know, anytime
0:40:08you make like a slightly wrong choice, like I remember, uh, so I was talking to, I don't know,
0:40:11it was Dennis Ritchie or one of the old Unix guys or whatever said, do you have any regrets about
0:40:15your career? And he said, I wish I'd put E and E on the create system call, you know, C-R-E-A-T.
0:40:19Wow. How long has he been living with that? Like, and like, I just, I wanted to save that character
0:40:23and now it's create for just for the rest of it. We're all, it's on Mac OS. It's on every Apple
0:40:27platform right now, somewhere in the source code, there's a call to create with no E on it because
0:40:31this guy made a bad decision in the seventies. And so you don't want that to be you. So yeah,
0:40:35spend the time arguing about it. And I think that what you said, like doing the,
0:40:38figuring out what you're going to do in the arguing about the keywords is a nice separation.
0:40:41So you can make forward progress, but I'm here to endorse arguing about keywords.
0:40:45It's also really valuable because there was a recent proposal called sending parameter and
0:40:51result modifiers. And we, we did the same thing there where we, you know, had the concept from
0:40:56the proposal. We accepted it in principle. And then we had a revision review to focus on the
0:41:00name of the keyword, which was originally called transferring. Now it's called sending.
0:41:04But the revision review thread is really interesting because a lot of people are coming in
0:41:08and as part of justifying why they think this keyword should be called something specific,
0:41:13they're reasoning through how they're thinking about the feature and how they would explain it
0:41:17to other people. And at points where they maybe got something slightly wrong, someone else would
0:41:22come in and say, Oh, I think this actually works this way. And I think this keyword's a little bit
0:41:26misleading. And so that review is really cool because it wasn't, it didn't feel like a really
0:41:32heated contentious debate. It felt like a healthy debate of people trying to come in and explain a
0:41:37concept and then listening to other people explain how they thought about it. And that's also
0:41:42valuable for us in figuring out how to actually explain the feature to Swift programmers, because
0:41:48what the formal specification is in the proposal is not, you know, the level of detail that you
0:41:55actually need to understand in order to use the feature. So yeah, those, those named bike shedding
0:42:00threads are valuable for, for a bunch of different reasons. That's part of the reason doing it in
0:42:03public, I feel like it's so beneficial because the people who are working on the proposal,
0:42:07know it at such an intimate level. And then you throw it in a bunch of people who have no idea
0:42:10what you're talking about and they will tell you, this is confusing to me. Like whether you're using
0:42:14a term of art, it's meaningful to compiler people, or you've just all internalized as a group, what
0:42:18this means, because you've been debating it for a month or whatever. And the word doesn't, doesn't
0:42:22ring make in their mind, make them think of what it actually is. And so changing the word will
0:42:27make it more learnable and more memorable. And, and again, the people who don't like bike shedding
0:42:30will say, well, yeah, it's a weird word, but you learn it and then it just becomes internalized.
0:42:35That's what happens to everybody, but that's, that doesn't make the language approachable.
0:42:37If you pick a good word, it will, if the word means what you want it to mean,
0:42:41it will help people learn the feature faster. I definitely find that because, you know, again,
0:42:45some, some Swift features, I read the proposal and I don't understand it until you change the
0:42:49keyword. And then I'm like, I'll read the same proposal. I'm like, Oh, now I get it because the
0:42:53word you've chosen is different. And now I understand what you're getting it. Even non
0:42:56copyable types was like that. It's like, didn't understand what you were trying to do until it
0:43:00went around a few times. I'm like, okay, start like the sending and whatever. And I think you
0:43:04picked that because of the, the, was it part of the synergy with sendable and everything?
0:43:08The connection with concurrency. Yeah. Previously it didn't sound like it had anything to do with
0:43:12concurrency. And so, so riffing off of sendable in a slightly different form so that it's not like,
0:43:17if I'm talking about sendable versus sendable, someone did actually suggest calling it like
0:43:20lowercase S sendable, but that's really difficult to talk about. But sending is close enough that
0:43:25you're, it's very clear. You're talking about sending a value over an isolation boundary
0:43:28because that's the term that Swift uses for that concept. So you have this immediate connection
0:43:31to concurrency and then you can dig in deeper to how it works. Just don't, don't let the math
0:43:35people use the language. Well, it's funny just to kind of reiterate what John said. You know,
0:43:39when I still had a real job and I was working with other switch developers, it was hilarious.
0:43:43The younger ones when our code base was some objective C was largely Swift, but you would bring
0:43:49a young, typically a younger person who has grown up on more, you know, JavaScript languages. And,
0:43:56and I think Swift is like that. And I don't mean that in a bad way. I mean that in a good way,
0:44:00it's much more approachable. And then we would, they would look at a file of objective C and they
0:44:05would just recoil because it just looks so different. Like even though they're, I like
0:44:10objective C just fine. I'm not a super fan, but I like it just fine, but it's so much less
0:44:14approachable. I think in so many ways, because it's so different. And I think those silly
0:44:18arguments about a till day, one of you said a minute ago, like a till day or not, and what
0:44:21keyword to use, they, they really dramatically in aggregate can change the whole kind of vibe of a
0:44:27language and Swift's vibe. I think Marco had said earlier, or maybe somebody has said, you know,
0:44:33there was a window, a time where it was getting a little architecture astronautty, I feel like,
0:44:37but I feel like that's really been brought around in a good way. And I feel like we're,
0:44:41we're heading on a good path. And those arguments, while I was one of those people that was like,
0:44:46Oh my God, why do I care? But then you just like John said, you think about it for a minute. You're
0:44:49like, Oh no, this is, this is where, and this is what you two just said, this is worth arguing
0:44:52about. And I think it's important. Architecture astronauts are saving your butt. Okay.
0:44:57You do a good, you're doing a good enough job of architecture astronaut and you're like, Oh,
0:45:00they all went away. No, they didn't. They just did. They just did their job.
0:45:03No, that's fair. That's fair. That's fair. Correct.
0:45:05Yeah. I mean, the goal is very much, we have to plot this path, right. Between helping people
0:45:10make code correct. And also helping make people easily able to bring forth what's what's on their
0:45:16mind and make it like a low ceremony language where they don't have to put that many keywords.
0:45:21And sometimes those two things can be intention. And that's something that the community really
0:45:26helps us work through. Right. Like, so, um, I think even with concurrency, right, the, the,
0:45:32the strict checking mode, the goal there is to have the compiler help you work through exactly
0:45:37what you're trying to express. Um, and so, um, sometimes we do have to, to, to resolve that
0:45:43tension. And that's really the game of language design is making sure that we keep that vision
0:45:47of having Swift be as low ceremony as possible, but not any lower than that. Right. Because if
0:45:52you have like no ceremony, then you don't know what's going on. And right now you're in like
0:45:57an untyped language where you, it's really difficult to, to understand exactly what the
0:46:01code is doing. If you have too much ceremony, then you get, you know, a language more like Java,
0:46:06where you have to like ride a, uh, multiple different things to, to achieve the same result
0:46:10that in Swift would just be like a couple of, uh, a couple of words. So yeah, it's, it's plotting
0:46:16that path. And that's actually something that, that we, we think Swift hits the spot of,
0:46:20which is why we think it will be such a great language to expand beyond, um, just its existing,
0:46:25um, app development ecosystem and expand into other places where people want like the performance of a,
0:46:32of a head of time compiled language that doesn't have garbage collection. Um, whilst also giving
0:46:38you the ability to have like a joyful experience writing code where you don't have to write that
0:46:41much code and you don't have to fit too much stuff in your head at once. Still hanging on to that
0:46:44dream Swift being the, uh, the language that spans from the, uh, the, the lowest level of the
0:46:48operating system up to a scripting. And there's, there's a lot of programmers who are the potential
0:46:52audience for Swift, but obviously a lot of the programmers who are your target audience are
0:46:57Apple employees. How do you work with the other teams at Apple when it comes to language features?
0:47:02How does that work? So did you just give example, like result builders, uh, for the Swift UI thing,
0:47:07non-copyable types, objective C interop, like, do you come to them and say, Hey, we think I have an
0:47:13idea. Did they come to you? Like how, what is the interaction with the rest of Apple for language
0:47:16features, the language readers that will obviously they will benefit everybody when they get out there
0:47:20in the world. But sometimes you look at them, you're like, Hey, that was language feature that
0:47:22was made specifically for teams at Apple. So they could adopt Swift fast or whatever.
0:47:27I mean, I think the way I would think about it is that no feature is ever good unless you use it.
0:47:33So when we're developing a feature, we really need to use, we really need to do that development
0:47:39with somebody who is directly using that feature. And ideally you do that development in real time.
0:47:46And so, um, when we're working with, um, a team like the Swift UI team, um, we really want to
0:47:53know that something like result builders is really going to hit the spot of them being able to create
0:47:57that, that really expressive API and develop that feature with them and have them use it and give us
0:48:04feedback. Are you bringing result builders to them or are they bringing the idea of the Swift UI to
0:48:08you and saying, we need, we need a generic system to do this? Like how is it? I don't think Swift UI
0:48:13in particular is not, or any, or any, so another example would be embedded Swift. So, um, obviously
0:48:18we, we're, we've got a lot of material this week. Um, and we've been putting it up actually prior
0:48:22to this week, um, encouraging people to check out embedded Swift and use it for, um, you know,
0:48:27developing for the raspberry PI Pico or the play date or something like that. But we also developed
0:48:32it in conjunction with some of our, uh, developers who are working on things like the secure enclave.
0:48:38And we've talked about, that's actually one of the, the, the places where we've adopted it this year.
0:48:42Um, and so we directly work with them and they inform, um, you know, our thinking about how to
0:48:49target that language mode. And it really ends up being a better product. I think if we developed
0:48:54the language ahead of time and then said, here it is, we knew you needed to do some firmware
0:48:58development. Here's a language that does it. We would not get as good a result. And my, another,
0:49:02another example of soft UI is like the old, the old, uh, limitation for the parameter things.
0:49:07You get one through 10 or whatever, and it wasn't parameter packs or whatever the thing that goes
0:49:10around that. It was that an example of like, okay, well you obviously didn't have the language
0:49:14teacher. They rolled out Swift UI anyway, and there was this kind of, you know, semi not well
0:49:18known limitation or whatever. And why was the limitation? There was a language limitation. Then
0:49:21you could look at that and say, all right, well, our language is failing the team here. How can we
0:49:27solve that? But not just by like hard coding, I think for a few, I, but adding a language feature
0:49:31that now is, you know, beneficial to anybody who wants to use it. But as a side effect,
0:49:36that limitation is Swift UI is gone. Yeah. So parameter packs specifically were a generics
0:49:41feature that I think we always knew we, we wanted to have because there's such a wide variety of use
0:49:47cases for them. And, um, Swift UI view builder is not the only API that adopted parameter packs.
0:49:52Last year. You also see it in foundations, predicate API. Um, you see it in weather kit APIs
0:49:58and because there's a lot of APIs that are structured like that, where you have a variable
0:50:01number of things that you pass in and then you get the same variable number of things as your output
0:50:05there. Um, but I, I help a lot of people try to express something in Swift, you know, every day
0:50:12across a wide variety of framework teams, people writing apps, people on the forums. Um, and one
0:50:17really important job of my team, uh, the, the language team is to take, see all of these
0:50:22different use cases that people have. Um, and first and foremost, help them use the language
0:50:27as it is today. And a lot of cases, people are just trying to use some feature that already exists
0:50:31and they need some help figuring out how to exactly make it work for their specific use case.
0:50:36And in cases where there is an expressivity limitation in the language, um, we take all of
0:50:42these different use cases, again, from a variety of different sources. Um, we use the forums as a
0:50:47big source of use cases for different things as well. Um, macros are a really great example of
0:50:52this. Um, we, there were a variety of different use cases, um, for frameworks at Apple, Swift data
0:50:58adopted macros. Um, the new observation, uh, library from last year as part of the Swift
0:51:03standard library uses macros, but there were also a ton of use cases spinning up on the forums about
0:51:07people who were wanting to do, to do really similar things in their code. And something
0:51:11that was awesome during the review process of macros and Swift evolution was, um, people were
0:51:18trying it out and putting up example macro packages, um, on GitHub. And, uh, that also
0:51:24was a really great example of people actually trying out the feature and seeing how it worked
0:51:28for them, um, at the same time that it was being developed and that turned into real feedback that
0:51:33was incorporated into the design. Um, so yeah, usually the way that these things work out,
0:51:38unless there's some big overarching goal, like, um, data race safety, that, that was a goal that
0:51:42was driven by us. Um, but a lot of times it's that we're helping so many different people use
0:51:47the language, um, in a variety of different ways, and we can, um, you know, generalize
0:51:53these expressivity limitations into a single language feature that works for everybody. Um,
0:51:58it's a really interesting process.
0:52:01parameter packs is actually a, uh, I think an example where we really feel like we're
0:52:06successfully doing what we try to do, which is have this progressive disclosure where we have
0:52:10these really advanced language features that ultimately are able to produce APIs, help people
0:52:17produce APIs that you would not know you're using these advanced features when you use them day to
0:52:22day. You do not know when you go create a view with 11 things in it that actually that is
0:52:26only possible because of parameter packs. You don't, you don't know that when you're, when you've
0:52:29got this really nice API where you tell the weather API to give you like temperature and wind speed,
0:52:34it's actually giving you two strongly typed values that then instead of giving you like two untyped
0:52:39values, like in any type value that you used to have before you immediately get these two strongly
0:52:44typed values where you get like code completion on exactly the, the, the, the types that you have,
0:52:48that, that, uh, that make it so much easier to use. Um, macros is another example where like
0:52:53the creation of macros was general enough that people were able to create these great new APIs
0:52:59that you do not have to think about when you're using them. So Swift testing is another one. I
0:53:03know you folks were ragging on the Flint design, uh, of other testing frameworks. And one of the
0:53:09beautiful things about Swift testing is that you write just regular expressions. I'm sorry.
0:53:14I shouldn't say that was the wrong term. You write ordinary expressions, ordinary Swift expressions,
0:53:21like a is not equal to nil or something like that. Um, you put them inside a pound expect and then,
0:53:28um, the pound expect macro will do some magic stuff under the hood to do reflection actually
0:53:32exactly similar to what you were talking about, where it breaks down the object and looks at all
0:53:35the different properties. We don't have different quiet. That's a great idea to maybe bring to the
0:53:38Swift forums and talk about it. You just look at any other testing framework. I'm pretty sure they
0:53:42know what they know. They know it exists. Fair enough. That's the thing with testing frameworks.
0:53:45There's so many of them. There's so much prior art and XC test was a little bit crusty, but like,
0:53:49there's, you're spoiled for choice. You just look at all of the popular languages and all the
0:53:53testing frameworks and you've chosen this time, not to go with a bunch of words with dots between
0:53:56them, but you know, some people like that. So I predict that Swift testing, uh, is, is it looks
0:54:01like a great advancement over what came before, but I feel like testing frameworks are difficult
0:54:05to get right on the second or third try. So going beyond XC test is great. You know, I, I, we
0:54:12actually had planned to talk to the both of you about more about Swift testing, but in, in
0:54:15interest of time, I wanted to give, or we wanted to give you guys a couple of, uh, the floor to
0:54:20answer a couple of, uh, softball questions. Uh, first of all, I'm going to start a little bit
0:54:25negative and then we're going to end with a positive. Is there any, I actually have a
0:54:31statement. No, um, do you, is there, is there any common misunderstanding in the community that
0:54:38maybe grinds your gears or you just feel bad? Like I'm trying to make this not so negative. Like you
0:54:43just feel bad that people just haven't grokked that, Oh, you know, all of us, myself may be
0:54:47included, think a, but it's actually Z, you know, or whatever the case may be. And maybe there isn't
0:54:52anything, but if you had, let's say, you know, a couple of minutes to correct some common
0:54:57misunderstanding, is there anything that jumps to mind about Swift? Not just the,
0:55:01yeah, there, there is one immediate one that comes to mind. Um, people in Swift love protocols.
0:55:06Protocols are great. I love protocols too. Um, but a lot of people when they're starting to write,
0:55:11you know, an app, um, they start by adding a protocol into their code and then they end up,
0:55:17um, using a lot more abstraction than they really needed to in their code. Like they
0:55:22ended up using any types or if you're familiar with the formal term existential types, um,
0:55:26which we had tried to steer people away from because those are a really complicated feature
0:55:31and understanding why they have some of the behaviors they have, um, is, is really, really
0:55:36nuanced and hard for a lot of people to grasp. And in a lot of cases you don't need them. Um, so I
0:55:41would tell people to start with a concrete type, start with a struct specifically until you, um,
0:55:46need more abstraction or you need, um, reference semantics and then sort of evolve from there. Um,
0:55:51the same thing is true of, um, global, I've seen so many people write static variables that never
0:55:57change throughout their code base. Um, so I would tell people to start with the lead and that's
0:56:01really helpful for, um, data race safety as well. Yeah. I blame a, what is it? Uh, you maybe, you
0:56:06know, a protocol oriented programming. Remember that I was thinking the same thing. A lot of
0:56:09people went to that session. I like protocols. They're the future. I'm starting every app with
0:56:12protocols. It's worth rewatching that talk. Like what the talk said was, if you're thinking about
0:56:17creating a sub typing relationship instead of a class hierarchy, start with the protocol.
0:56:22Unfortunately, what people heard was start with the, it's right in the title. You just,
0:56:27they read the title and they're like, great, I'm on board. Right. And so it gets to that point where
0:56:32like, it's kind of like the black box. Why don't they make the entire plane out of protocols? Right.
0:56:35That's not what you want. You want to start from, uh, from structs, like Holly said,
0:56:40and then generalize your problem when you find you need to generalize it. That's actually,
0:56:44they generalize it from the start. Yep. No, that's really good advice. And then, uh, finally,
0:56:48cause we really are running low on time. Uh, what are you proud of lately? Like, I mean, obviously,
0:56:52and I mean, there's obvious answers like Swift concurrency in, in the strict concurrency.
0:56:57It's an incredible land and you should be proud of that. But is there maybe something that,
0:57:01that, you know, your pet feature or project or what have you, that maybe not a lot of people
0:57:06seem like embedded Swift is a great example that, I mean, I've seen a lot of this on the WWDC session
0:57:10titles anyway, but is there something maybe a little more esoteric or, or just your pet thing
0:57:15that you're really, really into that you're proud of? I don't know if it's esoteric,
0:57:18but I think we're pretty proud of the progress we've made around cross platform support.
0:57:21That's especially something that we've been pushing this year. Um, we have, uh,
0:57:25support for more distros this year. Um, we have now Debbie and, and fedora. Um, we've, uh, been
0:57:31working with, um, uh, the community on creating this really great plugin for vs code that allows
0:57:37you to, to use vs code. If that's what you're into. Um, personally I'm sticking with X code,
0:57:41but like, and I know a lot of people have very personal preferences. Um, we also have some
0:57:45articles up on how to, to integrate a code completion into a, uh, uh, near VIM and Emacs
0:57:51if that's your jam as well. So, um, I think we've made really some really great progress in, in,
0:57:56in that area. And, uh, we've seen, uh, both internally and in the outside community,
0:58:01a lot of more, uh, rapid adoption of Swift on, on Linux environments, um, and on the server
0:58:07generally. I think, um, if you saw, um, some discussion in the keynote to the fact that we're
0:58:12now running Swift on the server to do some of the new Apple intelligence features. Um, and that's
0:58:16all built on this foundation that we've been working on for years with projects like the Swift
0:58:20Neo, uh, framework and things like that, that have always given us this ability to, to, to stand up
0:58:26servers, um, that have this really, uh, great ability to, again, have this high level language
0:58:33that we feel is really enjoyable to write, but that managed to get you in the case of the server,
0:58:37really low memory footprints, um, which can be a big challenge when it comes to, um, to, to large
0:58:43server, large server farms, especially. Um, and that's, that's been a really big win for us that
0:58:49we're pretty proud of. World domination is still on the table. Still on the table. How about you,
0:58:52Holly? Um, my team's focus this year was, um, you know, data race safety and Swift 6. I'm personally
0:58:59really proud of my team because a lot of the team was new to the, um, data race safety model and the
0:59:04concurrency model in general. Um, you know, at the beginning of this year, um, originally it was
0:59:11built by a smaller group of engineers and then more people got involved in concurrency. So, um,
0:59:16yeah, I'm, I'm really proud of the work that the team has put in in general into this release. And,
0:59:22um, I'm also really excited by how the community has started to adopt these features and surface
0:59:29feedback to us and talk about what's difficult, talk about what error messages are confusing and
0:59:34sort of seeing the community, um, really embrace this new model of programming and come to a shared
0:59:41understanding and, um, improve both the compiler and the documentation and the language. Um,
0:59:47I'm really excited to see where this goes from here. That's awesome. Ben Cohen, thank you so
0:59:52much for joining us. I really appreciate it. Thank you very much. Holly Borla. Thank you so very,
0:59:56very much to both of you guys. We really, really appreciate it. Thank you so much for having us
1:00:00and thank you to Apple for hosting. And with that, I think we're good. See you next week.
1:00:06(beep)