catatp.fm Unofficial Accidental Tech Podcast transcripts (generated by computer, so expect errors).

205: People Don't Use the Weird Parts

A surprisingly deep dive into Swift, now that one of us is finally using it.

Episode Description:

Transcript of this episode

Sponsored by:

  • Audible: With Audible, you’ll find what you’re looking for. Get a free 30-day trial.
  • Eero: Finally, Wi-Fi, that works. Use code ATP for free expedited shipping.
  • Squarespace: Build it beautiful. Use code ATP for 10% off your first order.

MP3 Header

Transcribed using Whisper large_v2 (transcription) + WAV2VEC2_ASR_LARGE_LV60K_960H (alignment) + Pyannote (speaker diaritization).

Chapters

  1. Intro
  2. LLVM and Bitcode
  3. Sponsor: Squarespace (code ATP)
  4. Management
  5. Origin of Swift
  6. Launch
  7. Swift use by Apple
  8. Transitional feelings
  9. Sponsor: Eero (code ATP)
  10. Open-sourcing
  11. Server-side Swift
  12. Low to high, easy to hard
  13. Sponsor: Audible
  14. Influences
  15. Why adopt now?
  16. Style and idioms
  17. Rust-style memory model?
  18. Swift in the browser
  19. ABI stability
  20. Leaving it in good hands
  21. The shoemaker’s language
  22. Dynamic features
  23. Community influence
  24. RxSwift
  25. GC vs. ARC
  26. Ending theme
  27. Post-show: Making splinters
  28. Post-show: Neutral

Intro

⏹️ ▶️ Casey So let’s start with some follow-up. Why did Chris Latner decide to leave Apple?

⏹️ ▶️ John Last week we talked about this and we tried to list all the reasons we could think of why he might be leaving

⏹️ ▶️ John and I think we covered most of the major threads of speculation and we didn’t really get a lot of listener feedback about

⏹️ ▶️ John it. Anybody who did reply was mostly voting for one of the things we talked about. But here’s the thing on this topic.

⏹️ ▶️ John Unless there’s some kind of like secret doomsday thing about Apple that only Chris knows, it’s

⏹️ ▶️ John not actually that important that we figure out why he left Apple or what was in his heart of hearts,

⏹️ ▶️ John aside from just us being busybodies and just wanting to know, like gossip type stuff. And

⏹️ ▶️ John second, pragmatically speaking, this is just not the type of thing that people who leave Apple talk

⏹️ ▶️ John about. Or if they do talk about it, it’s like years and years later after, no one cares anymore, or

⏹️ ▶️ John it’s not a big deal. So even if there was some deep, dark reason, it’s not like we would know about it

⏹️ ▶️ John until years from now. Honestly, the straightforward, boring explanation is probably the right one anyway.

⏹️ ▶️ John So, you know, I don’t know. What do you think, Chris? That sounds about right to me, John.

LLVM and Bitcode

⏹️ ▶️ Marco Would you ever buy an electric car in white? You

⏹️ ▶️ Marco are

⏹️ ▶️ Casey such a jerk. Why are you so mean to me, Marco?

⏹️ ▶️ Chris Latner No, no, no. I’m a fan of red cars.

⏹️ ▶️ Chris Latner, Casey There you go. Yellow, if I could get them.

⏹️ ▶️ Casey Yellow, that’s bold. My

⏹️ ▶️ Casey, Chris Latner goodness.

⏹️ ▶️ Casey All right. We obviously need to talk about what’s happening right now. So ATP is not

⏹️ ▶️ Casey an interview show, but in extraordinary circumstances, weird things

⏹️ ▶️ Casey can happen. And so in today’s episode, we have an extraordinary circumstance.

⏹️ ▶️ Casey Former Apple employee Chris Ladner was nice enough to join us on the show. And so

⏹️ ▶️ Casey this is going to be three people interviewing one person, which is, to say the least, a bit peculiar.

⏹️ ▶️ Casey And it’s something that we’ve never really done before. So this could be a little bit of a rough ride, but

⏹️ ▶️ Casey we’re going to try to make our best of it. And I’ll just say right up front, thank you so much, Chris, for coming

⏹️ ▶️ Casey on the show. And we definitely appreciate it. To kind of kick all this off, would you mind giving

⏹️ ▶️ Casey us a nickel tour of who is Chris Lattner?

⏹️ ▶️ Chris Latner Okay. Well, I can try. I’m a programmer. I love coding. I have for

⏹️ ▶️ Chris Latner a long time. I’m most widely known for starting LLVM

⏹️ ▶️ Chris Latner and getting it off the ground and handing it off to other smarter people. I started Clang, which is

⏹️ ▶️ Chris Latner a C++ Objective-C compiler, and likewise got it to the point where it was

⏹️ ▶️ Chris Latner thriving and then let other smarter people run it, and then started Swift and got

⏹️ ▶️ Chris Latner Swift going, and it recently got past 3.0, and it has an amazing community,

⏹️ ▶️ Chris Latner and it has a great team of people running it, and now I’m ready to jump to the next thing. And so

⏹️ ▶️ Chris Latner I guess the short version of what I’d like to do is tackle really hard problems

⏹️ ▶️ Chris Latner and do things that most people think are impossible.

⏹️ ▶️ John So we’re gonna go back in time a little bit, and I hope that you could tell us

⏹️ ▶️ John how you ended up coming to Apple, like if you can remember back that far. Like, you, you know, LLVM you started

⏹️ ▶️ John before you were at Apple, right? So how did you end up at Apple? Yeah,

⏹️ ▶️ Chris Latner that’s a great question. So I started working at LLVM at the University of Illinois. It was a

⏹️ ▶️ Chris Latner research project, and the, it really was

⏹️ ▶️ Chris Latner kind of hoped for and designed to be fully general and production quality and all those great

⏹️ ▶️ Chris Latner things that you’d want as a graduate student for people to use your code, but it also

⏹️ ▶️ Chris Latner wasn’t. It had a lot of the great architectural ideas maybe, but

⏹️ ▶️ Chris Latner it wasn’t fully baked. It wouldn’t solve all the world’s problems.

⏹️ ▶️ Chris Latner And by the time I got to graduate, the question was, what do I do next? And of course my dream

⏹️ ▶️ Chris Latner was to continue pushing it forward and build it out to be something real. And to do that, I would have to

⏹️ ▶️ Chris Latner go to a place that would allow me to work on it. and I was really fortunate to have built some relationships with

⏹️ ▶️ Chris Latner folks at Apple, and they took a chance on me, and I jumped to Apple and started building out

⏹️ ▶️ Chris Latner LLVM as my job. It was totally a dream of mine. So that’s

⏹️ ▶️ Chris Latner, John how I got to Apple. Did you

⏹️ ▶️ John graduate? Did you get your degree and then go to Apple?

⏹️ ▶️ Chris Latner Yeah, yeah.

⏹️ ▶️ John Well, that was nice.

⏹️ ▶️ John, Chris Latner Otherwise, how would you ever

⏹️ ▶️ John, Marco get a

⏹️ ▶️ John job? Yeah, you can’t get a job without a degree. We all know that.

⏹️ ▶️ John, Marco No.

⏹️ ▶️ John, Casey Yeah, clearly. So

⏹️ ▶️ John how would you explain LLVM to somebody who doesn’t know stuff about compilers? Because we

⏹️ ▶️ John all just rattle off LLVM, compiler building toolkit, or whatever. But how would you explain

⏹️ ▶️ John that to someone, because not all of our listeners are programmers, who isn’t intimately familiar with how a compiler works?

⏹️ ▶️ Chris Latner Sure. So first, we start with what is a compiler? A compiler is the thing

⏹️ ▶️ Chris Latner that takes the code that a programmer writes and turns it into something the machine can understand.

⏹️ ▶️ Chris Latner And so there’s lots of different kinds of computers with lots of different kinds of processors. Most programmers

⏹️ ▶️ Chris Latner don’t want to have to think about that know about that and they want to program and think at a much higher

⏹️ ▶️ Chris Latner level than what the actual processor can do. And so the compiler’s job is to transform

⏹️ ▶️ Chris Latner what the human wrote and to something the machine can understand. Then LLVM

⏹️ ▶️ Chris Latner is a modular system for building different kinds of compilers because

⏹️ ▶️ Chris Latner there’s lots of different reasons people would want to use compiler technology. And I think LLVM was most

⏹️ ▶️ Chris Latner successful over the years because it was built as reusable components,

⏹️ ▶️ Chris Latner kind of like a framework. And then the framework can be used to solve lots of different problems.

⏹️ ▶️ Chris Latner And one of the fun things about LLVM is that it was eventually over the years used to solve problems that

⏹️ ▶️ Chris Latner we had never even imagined, which is really exciting.

⏹️ ▶️ John So one example of the type of problem is I remember from past WWDCs,

⏹️ ▶️ John the idea that the Xcode IDE, the GUI that programmers use to make their applications,

⏹️ ▶️ John that very often in that GUI, you need to do things that have an understanding of the code.

⏹️ ▶️ John But when the compiler is this big monolithic thing, the best you can kind of do is compile everything in the background and

⏹️ ▶️ John spit out some stuff. But when it’s a modular toolkit, you can take those pieces and

⏹️ ▶️ John just use the part that understands like the syntax tree or whatever and iterate them. Was that the first

⏹️ ▶️ John use of LLVM as something other than like a straight up

⏹️ ▶️ John compiler that you just point to your code and produces output? like, in other words, integrating it into

⏹️ ▶️ John applications? Or was there some use before that?

⏹️ ▶️ Chris Latner Well, I think the first use in production was in the OpenGL stack, which ended

⏹️ ▶️ Chris Latner up shipping in a late software update for Tiger, as well as in Leopard,

⏹️ ▶️ Chris Latner which is 10.4 and 10.5. There it was used in

⏹️ ▶️ Chris Latner a completely invisible way to basically repack data and upload it to

⏹️ ▶️ Chris Latner the GPU. And so when you’re making OpenGL calls to, say,

⏹️ ▶️ Chris Latner GL vertex 3F or whatever the low-level GL call is, those

⏹️ ▶️ Chris Latner vertices need to be transformed into a very specific data format the GPU can understand. And you

⏹️ ▶️ Chris Latner have a whole bunch of different kinds of calls that can be used to produce vertex or other geometry data.

⏹️ ▶️ Chris Latner But you also have a matrix of different kinds of GPUs you need to support. And they all have different formats

⏹️ ▶️ Chris Latner and different capabilities and requirements. And so LLVM was used to generate very small chunks of code to do that.

⏹️ ▶️ Chris Latner And it was part of the 64-bit bring up in the Leopard time frame. And so that was probably the first

⏹️ ▶️ Chris Latner completely invisible use of it that used and proved a lot of the code

⏹️ ▶️ Chris Latner generation technologies.

⏹️ ▶️ John So forgive me, one more LLVM related thing is we’re going to go from what is a compiler all the way down to nitty gritty

⏹️ ▶️ John stuff here. My vague recollection of what you just described, the whole video driver thing, was that

⏹️ ▶️ John there were files on disk in the shipping OS that were basically LLVM byte code, like these little

⏹️ ▶️ John BC files, and they would get slurped up and converted to

⏹️ ▶️ John machine code appropriate for the GPU. Am I right about that?

⏹️ ▶️ Chris Latner Yeah, you’re absolutely right. And so basically, the way to look at it is the

⏹️ ▶️ Chris Latner bit code files, the LLVM that shipped with the OS, were little snippets of code

⏹️ ▶️ Chris Latner that then at runtime were recombined and optimized across. And so that was kind of the library

⏹️ ▶️ Chris Latner of primitives that the OpenGL runtime used to assemble what it was trying to

⏹️ ▶️ John do. All right, so my question about this, and maybe you kind of alluded to it with either a slip of the tongue or a revealing understanding is,

⏹️ ▶️ John what is the difference between LLVM bytecode and what Apple currently brands as bitcode?

⏹️ ▶️ Chris Latner Oh, well, are you asking for a historical question? Is this a historical question

⏹️ ▶️ Chris Latner, John or do you? It’s

⏹️ ▶️ John a technical and historical because I’m confused by the branding and I’m also confused by the tech.

⏹️ ▶️ Chris Latner So LLVM prior to LLVM 2.0, and these version numbers

⏹️ ▶️ Chris Latner are the open source version numbers not related to the Apple version numbers, and they’re confusingly different for

⏹️ ▶️ Chris Latner not very interesting reasons. But before 2.0, it used a really horrible

⏹️ ▶️ Chris Latner encoding in binary that was branded bytecode because that’s what Java

⏹️ ▶️ Chris Latner used. It had a whole bunch of problems in that it wasn’t extensible, it was fragile,

⏹️ ▶️ Chris Latner the LLVM was changing, it didn’t have compatibility. And so

⏹️ ▶️ Chris Latner in the LLVM 2.0 timeframe, which gosh, it’s probably, I don’t know,

⏹️ ▶️ Chris Latner 10 years ago or more, it’s been a long time ago now, I

⏹️ ▶️ Chris Latner redesigned the whole thing and it now uses this quote unquote bitcode format and use bitcode

⏹️ ▶️ Chris Latner as a term for two reasons. One of which was it was different than bytecode. And so the two could live side by side

⏹️ ▶️ Chris Latner in the directory tree for a while. And the second reason is that the encoding is a bitstream format instead

⏹️ ▶️ Chris Latner of a byte stream. But that’s the origin of the term bitcode. You can find

⏹️ ▶️ Chris Latner documentation on this file format. It’s actually a very general encoding format you can use for

⏹️ ▶️ Chris Latner XML type purposes. It’s a self-describing file format. And multiple

⏹️ ▶️ Chris Latner different things can be encoded in bitcode.

⏹️ ▶️ John Yeah, there was definitely some confusion about that, because when Apple presented it, when they presented it as the requirement was the watch apps

⏹️ ▶️ John have to be in bitcode. Marco, you would know this.

⏹️ ▶️ Marco Watch is required. iOS is still optional.

⏹️ ▶️ John Yep, and then TV is required. And they would have you put your stuff in bitcode. And there was a lot

⏹️ ▶️ John of speculation early on about what that meant, like in terms of,

⏹️ ▶️ John does that mean that what you’re uploading is not a finished binary? And therefore, it’s like this

⏹️ ▶️ John machine-agnostic thing could be targeted at any CPU. And the more prosaic version,

⏹️ ▶️ John like it doesn’t mean it’s CPU-agnostic. All it means is that Apple has slightly more freedom

⏹️ ▶️ John to change instructions on the CPUs that they do target. How would

⏹️ ▶️ John you characterize the, what advantage are there of

⏹️ ▶️ John compiling something to bit code and then uploading it somewhere versus sending someone a binary? Sure,

⏹️ ▶️ Chris Latner there’s a couple of different advantages for that. One of which is that the compiler keeps getting

⏹️ ▶️ Chris Latner better. And so if the compiler learns a new optimization, it can be applied to existing applications without

⏹️ ▶️ Chris Latner app developers having to re-upload their app. So that’s one small thing.

⏹️ ▶️ Chris Latner Other things are that Apple does periodically add new instructions to its CPUs.

⏹️ ▶️ Chris Latner One example of this historically was the hilariously

⏹️ ▶️ Chris Latner named Swift chip that it launched, which was the first designed in-house 32-bit

⏹️ ▶️ Chris Latner ARM chip. This was the iPhone 5, if I recall.

⏹️ ▶️ Chris Latner, Marco That’s right.

⏹️ ▶️ Chris Latner So in this chip, they added an integer divide instruction. And all the chips before that didn’t have the ability

⏹️ ▶️ Chris Latner to do an integer divide in hardware, you had to actually open code it, and there’s a library function to do

⏹️ ▶️ Chris Latner that. And so that and a few other instructions they added were a

⏹️ ▶️ Chris Latner pretty big deal and used pervasively, and the only way to tackle that and handle that

⏹️ ▶️ Chris Latner and use it effectively was to introduce an entire new slice. And so if you’re an app developer back then,

⏹️ ▶️ Chris Latner you had the V7 slice, which was all the older chips, and then you had a V7S

⏹️ ▶️ Chris Latner slice, S for Swift, which was the slice

⏹️ ▶️ Chris Latner that included the integer divide. Now this is a pain for app developers, it’s a pain for Apple.

⏹️ ▶️ Chris Latner Everybody has to convince all the developers to take it seriously, and if app developers don’t support it

⏹️ ▶️ Chris Latner then the new hardware doesn’t benefit from it. And so Bitcode allows that kind of thing to go

⏹️ ▶️ Chris Latner completely away. So with Bitcode, Apple can just recompile the applications in the store and say,

⏹️ ▶️ Chris Latner ha ha, this device has an integer divide instruction, and it works perfectly with

⏹️ ▶️ Chris Latner the thinning kind of architecture they have for deploying resources to specific device types,

⏹️ ▶️ Chris Latner and it all kind of plugs together. Bitcode is not a magic

⏹️ ▶️ Chris Latner solution, though. It doesn’t, you can’t take a 32-bit app, for example, and run it on

⏹️ ▶️ Chris Latner a 64-bit device. That kind of portability isn’t something that Bitcode can give you, notably because

⏹️ ▶️ Chris Latner that is something that’s visible in C. And so, as you’re writing C code, you can write if

⏹️ ▶️ Chris Latner def, you know, pointer size equals 32, And that’s something that Bitcode can’t abstract

⏹️ ▶️ Chris Latner over. And so it’s useful for very specific low level kinds of

⏹️ ▶️ Chris Latner enhancements, but it isn’t a panacea that makes everything magically portable.

⏹️ ▶️ John The same thing I would assume for like architecture changes, especially if there was an Indian difference, because Indianness is visible from the sea

⏹️ ▶️ John world. So you can’t target different Indianness.

⏹️ ▶️ Chris Latner Yep,

⏹️ ▶️ Chris Latner, John yeah.

⏹️ ▶️ Chris Latner So it’s not something that magically solves all portability problems, but it is very useful for specific problems

⏹️ ▶️ Chris Latner that Apple’s faced in the past.

⏹️ ▶️ John And going back to the slice thing, that’s like terminology, the Mako format, where you get to put

⏹️ ▶️ John different architectures worth of executables? Or is that a different?

⏹️ ▶️ Chris Latner Yeah, I think that’s technology that goes all the way back to Next, when Next supported really heterogeneous

⏹️ ▶️ Chris Latner different architectures like PA-Risk and Spark and PowerPC and Intel,

⏹️ ▶️ Chris Latner all back in the Next days. And it allows you to compile your application with

⏹️ ▶️ Chris Latner multiple slices, they call them. And then there’s a tool called LiPo, which sticks them together.

⏹️ ▶️ Chris Latner And at runtime, the OS picks the slice that best matches your

⏹️ ▶️ Chris Latner CPU in practice. And so an app developer can support many different kinds of architectures, and then

⏹️ ▶️ Chris Latner the OS just does the right thing. And so in today’s world, it’s very common to build

⏹️ ▶️ Chris Latner an iOS app, for example, for both ARM64 and ARM32. And the way that works

⏹️ ▶️ Chris Latner in the native, in the simplest cases, is just two different binaries that are stuck

⏹️ ▶️ Chris Latner together, and then the OS picks the right one to run.

⏹️ ▶️ John All right, I could go on for this forever, but I don’t want to get too far down this rat hole. It’s just there’s some

⏹️ ▶️ John pent up questions about bitcode and bytecode, but now I feel satisfied and we can move on to broader topics.

⏹️ ▶️ Marco You’re sponsored tonight by Squarespace.

⏹️ ▶️ Marco Go to squarespace.com and use code ATP to get 10% off your first purchase. It’s the

⏹️ ▶️ Marco new year. You might have a new project, you might have a new goal you want to reach, and that might involve making

⏹️ ▶️ Marco a website. Make your next move with a beautiful website from Squarespace.

⏹️ ▶️ Marco Squarespace sites are so incredibly easy to make, and they’re incredibly beautiful,

⏹️ ▶️ Marco and the tools are very powerful. This is a great combination that I personally have never seen before

⏹️ ▶️ Marco in the web building space until Squarespace. The amount of power you get with these tools is just incredible.

⏹️ ▶️ Marco You can make so many different kinds of sites with so little effort. Nothing else comes

⏹️ ▶️ Marco close. Your sites look professionally designed regardless of your skill level with no coding

⏹️ ▶️ Marco required, although if you want to jump in and alter some of the code you actually can. But you don’t have to and it

⏹️ ▶️ Marco probably isn’t a good use of your time because Squarespace is such a great platform right out of the

⏹️ ▶️ Marco box. Whether you’re making a website for you or for somebody else. If you make it for somebody else,

⏹️ ▶️ Marco Squarespace is the place you want to do that because you show them how to use Squarespace and then you’re

⏹️ ▶️ Marco done. They’re not coming to you anymore. Squarespace will support it if they need help and they’ll be able to figure things out on their own

⏹️ ▶️ Marco because it’s just so much easier to use than whatever CMS you were going to install on their server. So check it out today. Go

⏹️ ▶️ Marco to squarespace.com, use code ATP to get 10% off your first purchase when you

⏹️ ▶️ Marco decide to sign up.

Management

⏹️ ▶️ Marco Whether you’re making a site for you or somebody else, make your next move with Squarespace.

⏹️ ▶️ Casey So, Chris, how was your transition from coding to being a manager? Because from an outsider’s

⏹️ ▶️ Casey point of view, it looked like you had arrived at Apple, you were working heavily on LLVM, like you had said

⏹️ ▶️ Casey earlier. But over time, I mean, even just looking at the resume on your website, it seems pretty clear that you were doing

⏹️ ▶️ Casey a lot more managing lately than perhaps coding. Or maybe you just worked

⏹️ ▶️ Casey around the clock, that wouldn’t surprise me either. How did you feel about your transition from

⏹️ ▶️ Casey being just a code monkey to being a manager? And I ask in part because at my phase of my career,

⏹️ ▶️ Casey I am still a code monkey, but I think it’s not too far away that I might become a manager. And so I’m curious

⏹️ ▶️ Casey to hear, you know, from one code monkey to another, how did that transition go and what did you

⏹️ ▶️ Casey learn from it?

⏹️ ▶️ Chris Latner Yeah, that’s kind of interesting. So I don’t think it is a hard transition. I’m still

⏹️ ▶️ Chris Latner writing code. I still love writing code. That’s something that I think is a key part of my

⏹️ ▶️ Chris Latner identity. In a lot of ways. But on the other hand, it is very strange. So I

⏹️ ▶️ Chris Latner started managing people at Apple really pretty early on, maybe a year

⏹️ ▶️ Chris Latner or so after I joined. I started managing two or three people because I

⏹️ ▶️ Chris Latner was kind of the best person to manage the nascent LLVM effort at the time.

⏹️ ▶️ Chris Latner And initially it was mostly just being a tech lead. And so if

⏹️ ▶️ Chris Latner you’ve ever driven a project where you have coworkers that don’t report to you,

⏹️ ▶️ Chris Latner but you’re kind of guiding them and helping make technical decisions, that’s where it started. Over

⏹️ ▶️ Chris Latner time, my team grew and eventually ended up picking up

⏹️ ▶️ Chris Latner and running kind of a second level manager role where you’re managing other managers And

⏹️ ▶️ Chris Latner each step along the way, it introduces new challenges. And along the way, I told myself that

⏹️ ▶️ Chris Latner managing is something that I had to do because I was the best qualified to do

⏹️ ▶️ Chris Latner it, and I didn’t want anybody else to. And that coding was my real joy and passion.

⏹️ ▶️ Chris Latner And I think that coding really is my joy and passion. But along the way, looking back, I

⏹️ ▶️ Chris Latner realized that I am actually pretty good at managing. And I really do like building

⏹️ ▶️ Chris Latner teams. I like working with people. And I’ve never considered myself to be a people person, which is,

⏹️ ▶️ Chris Latner you know, it’s just very, very odd for me to even think about that. But I actually do understand

⏹️ ▶️ Chris Latner how people work and can really care about getting the most out of people

⏹️ ▶️ Chris Latner and working with them to make them successful. And so it’s been kind of a

⏹️ ▶️ Chris Latner transition over time, but I’ve always hung on to coding. And even though I have a full-time management

⏹️ ▶️ Chris Latner job, I code like crazy on nights and weekends. And I’m not the kind of guy that likes

⏹️ ▶️ Chris Latner to sit around idle, and so I’ve always just been busy.

Origin of Swift

⏹️ ▶️ John So, I mean, you can get into as much of this history as you want to, Chris, but how did you get

⏹️ ▶️ John Swift to happen inside Apple? Because from the outside, it’s mysterious to us

⏹️ ▶️ John how big important projects come to be. Like, you

⏹️ ▶️ John know, you name the headlining things that have come out of Apple, we hear that Apple does a lot of things

⏹️ ▶️ John that don’t see the light of day. How did you get probably one of the biggest things ever to come out

⏹️ ▶️ John of Apple, an entirely new language, created in-house? How did you get that to happen and not just be

⏹️ ▶️ John some little thing that was off to the side that fizzled off and disappeared?

⏹️ ▶️ Chris Latner Sure. Well, so I can tell you about Swift, but I don’t think you should project this onto every other

⏹️ ▶️ Chris Latner project at Apple because I’m sure they’re all different. So I can just talk about my experiences.

⏹️ ▶️ Chris Latner So Swift started in 2010. You know, it’s

⏹️ ▶️ Chris Latner kind of the timing is suspicious because it’s right after a blogger wrote something

⏹️ ▶️ Chris Latner about how Apple needed a new programming language. I’m not a blogger.

⏹️ ▶️ Chris Latner Oh, okay. Ars Technica wasn’t a thing?

⏹️ ▶️ John That’s not a blog. That was a prestigious website. It still is.

⏹️ ▶️ Chris Latner Okay, okay. I stand corrected. So

⏹️ ▶️ Chris Latner, John I don’t remember

⏹️ ▶️ Chris Latner if I read it exactly then and that was a causal link to starting working on Swift or

⏹️ ▶️ Chris Latner if it was just because I had just finished up Clang C++ support and we launched

⏹️ ▶️ Chris Latner Clang C++. And of course, if you write C++ code, you know how ugly and

⏹️ ▶️ Chris Latner horrible it is. But if you implement C++, it’s a whole other level

⏹️ ▶️ Chris Latner, Casey of challenge.

⏹️ ▶️ Chris Latner And so getting that first release out was a major accomplishment for the entire team. And it

⏹️ ▶️ Chris Latner was a major, major effort for a ton of people involved. And

⏹️ ▶️ Chris Latner as is typical, you get something over the finish line. And of course, it wasn’t fully finished. It’s a lot of long ways to go. But a lot

⏹️ ▶️ Chris Latner of the intellectually interesting, to me at least, pieces were done.

⏹️ ▶️ Chris Latner That’s when I started thinking about, okay, well what comes next? And then implementing other people’s

⏹️ ▶️ Chris Latner stuff, like for example, the C, the C++, the Objective-C, standards and

⏹️ ▶️ Chris Latner languages. But there were things that we weren’t happy with

⏹️ ▶️ Chris Latner and things I wasn’t happy with. And so SWF started out as just a, let’s

⏹️ ▶️ Chris Latner see what could be done, right? Let’s see what a much simpler language that doesn’t need a preprocessor,

⏹️ ▶️ Chris Latner doesn’t need trigraphs, doesn’t need all the weird things that have accumulated into

⏹️ ▶️ Chris Latner C and C++ over the years. Let’s see what we can do and just try

⏹️ ▶️ Chris Latner to build something nicer. Initially, it was really just me messing

⏹️ ▶️ Chris Latner around and nobody knew about it because it wasn’t anything to know about.

⏹️ ▶️ Chris Latner But eventually, it got a little bit more serious and said, hey, well, after playing around

⏹️ ▶️ Chris Latner a little bit, I think that this actually could make sense. And so I started talking to my management,

⏹️ ▶️ Chris Latner started talking to some of the engineers that were working on Clang, and they seemed excited about it. We

⏹️ ▶️ Chris Latner got a couple people working on it part-time, and I convinced my manager that it was interesting

⏹️ ▶️ Chris Latner enough that we could have a couple of people work on it. Now, this wasn’t

⏹️ ▶️ Chris Latner a major commitment. This was a, okay, well, let’s see what there is here.

⏹️ ▶️ Chris Latner And that started a kind of internal demo schedule and other things, or we set milestones

⏹️ ▶️ Chris Latner in place and tried to justify the investment that was being put into it.

⏹️ ▶️ Chris Latner Eventually, it got to the point where it was far enough along that it

⏹️ ▶️ Chris Latner was posing strategic questions. So the strategic questions were of the form, OK,

⏹️ ▶️ Chris Latner we have Objective-C. Objective-C is a great language. It is probably

⏹️ ▶️ Chris Latner directly responsible for the iPhone being successful because

⏹️ ▶️ Chris Latner it’s really high performance. It allows you to get your job done. It supports high level

⏹️ ▶️ Chris Latner frameworks in a beautiful way. There’s a ton of stuff to love about Objective-C. And while there are

⏹️ ▶️ Chris Latner a few things that are ugly about it, some at signs and semicolons and other stuff like that, you know, we can make Objective-C

⏹️ ▶️ Chris Latner better. And so the question was always, why not just make Objective-C better,

⏹️ ▶️ Chris Latner right? Why don’t we just keep evolving Objective-C and why do we want to face potential disruption

⏹️ ▶️ Chris Latner in terms of moving the entire development community to something new. And we kicked

⏹️ ▶️ Chris Latner that around for a long time. We talked about both sides. And we came to realize that, yes, we can and

⏹️ ▶️ Chris Latner should make Objective-C better. And we continue to invest in Objective-C. We did things

⏹️ ▶️ Chris Latner like Arc, for example, which is a major effort. But we got dots.

⏹️ ▶️ Chris Latner Oh, well, so dot syntax predated this.

⏹️ ▶️ Chris Latner, Marco Aw.

⏹️ ▶️ Chris Latner Yeah, dot syntax. So the Objective-C 2 features and the block syntax were all

⏹️ ▶️ Chris Latner kind of prior to this. I worked on blocks, but it wasn’t in this

⏹️ ▶️ Chris Latner timeframe. And so we were talking about, okay, well, can we just make Objective-C better? And can we

⏹️ ▶️ Chris Latner feature creep it to the language that we want for the fullness of time? Because if we can, that’d be much less disruptive

⏹️ ▶️ Chris Latner to the community. And we decided that, yeah, we can move Objective-C a lot closer to

⏹️ ▶️ Chris Latner what we want. So we can get automatic memory management with ARC, for example, but we can’t ever take

⏹️ ▶️ Chris Latner away the problems that lead to Objective-C being unsafe. And

⏹️ ▶️ Chris Latner the fundamental problem was Objective-C was built on top of C. And C inherently has

⏹️ ▶️ Chris Latner pointers, it has uninitialized variables, it has array overflows, it has all these problems

⏹️ ▶️ Chris Latner that even if you have full control of your compiler and tool stack, you just can’t fix.

⏹️ ▶️ Chris Latner Right, to fix dangling pointers, you would have to fix lifetime issues and C doesn’t have

⏹️ ▶️ Chris Latner any framework to reason about that. And retrofitting that into a compatible way into the system just wouldn’t

⏹️ ▶️ Chris Latner really work. If you took away C for Objective-C, you couldn’t use C arrays on the stack,

⏹️ ▶️ Chris Latner for example. And if you couldn’t do that, there’s entire classes of applications where the

⏹️ ▶️ Chris Latner performance just wouldn’t be acceptable. And so we went around, around, around. We said, okay,

⏹️ ▶️ Chris Latner the only way that this can make sense in terms of the cost of the disruption

⏹️ ▶️ Chris Latner to the community is if we make it a safe programming language, which means

⏹️ ▶️ Chris Latner not safe as in you can have no bugs, but safe in terms of memory safety, while

⏹️ ▶️ Chris Latner also providing high performance and moving the programming model forward. And so that was

⏹️ ▶️ Chris Latner really kind of the ideas that came together to make Swift being worth

⏹️ ▶️ Chris Latner the investment and being worth being disruptive to the community. So a lot of these

⏹️ ▶️ Chris Latner kinds of pitches and ideas were being held in very small,

⏹️ ▶️ Chris Latner small, small meetings. small meetings. And coming

⏹️ ▶️ Chris Latner out of W3C 2013 is when we and the executive team decided, okay, let’s really

⏹️ ▶️ Chris Latner commit to this. And that’s coming out of W3C 2013 is when the developer tools team

⏹️ ▶️ Chris Latner came to know about it and really started working hard on it. And Swift is a

⏹️ ▶️ Chris Latner huge, huge effort by hundreds of people. And that’s when all the work

⏹️ ▶️ Chris Latner on bring up the debugger and the IDE support and playgrounds and all the other things that

⏹️ ▶️ Chris Latner the charge into Swift 1.0 really started coming together and make happen.

⏹️ ▶️ Chris Latner So that’s kind of how Swift came to be. It was again one step after another building small

⏹️ ▶️ Chris Latner things, explaining to people why it made sense, why it was worth it. And then also

⏹️ ▶️ Chris Latner I think that a major important aspect of Swift being I

⏹️ ▶️ Chris Latner guess worth taking a risk on was that we we told people that we would

⏹️ ▶️ Chris Latner not guarantee source compatibility in 1.0. And that was really

⏹️ ▶️ Chris Latner interesting because that actually was a big relief for people because internally

⏹️ ▶️ Chris Latner that meant that it didn’t have to be perfect when it launched. It meant that we could learn,

⏹️ ▶️ Chris Latner we could adapt. And that as long as we were clear with the community about that, that that would allow

⏹️ ▶️ Chris Latner us to get to ultimate greatness and learn from actual usage and practice.

⏹️ ▶️ Chris Latner And I think that was a really key piece to Swift coming and actually making it to the market.

⏹️ ▶️ John So strategically speaking, when you were doing the work to improve Objective

⏹️ ▶️ John C, did you have in mind the ability to potentially leverage

⏹️ ▶️ John some of that work for Swift? I’m trying to think of the strategy of how you get it done. Part of it is personal

⏹️ ▶️ John relationships and knowing the right people. Part of it is persuasion. You have to persuade them with your technical

⏹️ ▶️ John arguments and your business arguments and stuff like that. And then part of it was part of it also

⏹️ ▶️ John laying the groundwork with efforts and technologies that have multiple uses.

⏹️ ▶️ Chris Latner Yeah, absolutely. So one great example of that is Arc. It was really clear to me that

⏹️ ▶️ Chris Latner if we were to get to memory safety, we had to have automatic memory management. And I don’t know if you want

⏹️ ▶️ Chris Latner to go down the GC versus Arc rabbit hole or not, but Arc seemed like obviously the right

⏹️ ▶️ Chris Latner model to me and to some other people. And so we

⏹️ ▶️ Chris Latner said, OK, we need to get to an automatic memory management model. Objective-C isn’t, because

⏹️ ▶️ Chris Latner Objective-C at the time had the Obj-C garbage collector, which had numerous problems.

⏹️ ▶️ Chris Latner And so we had to get Objective-C to be memory managed. And so that’s why ARC

⏹️ ▶️ Chris Latner became a thing. It became a really high priority. And I think that it’s a great example of

⏹️ ▶️ Chris Latner something that by itself had a huge amount of value to the Objective-C community. And then after that,

⏹️ ▶️ Chris Latner we had similar other efforts, like modules, for example. That was a huge thing that both

⏹️ ▶️ Chris Latner improved build time, but was also absolutely essential to enabling Swift code

⏹️ ▶️ Chris Latner to eventually just say import UI kit and get everything. And so there’s a number of things that rolled

⏹️ ▶️ Chris Latner out over the years. And it was really funny at the time, because the Objective-C developers

⏹️ ▶️ Chris Latner externally, and even internally to Apple, always accused the compiler and languages team of taking Objective-C

⏹️ ▶️ Chris Latner on this random walk. and they didn’t know how it all fit together. And where is the strategy, and

⏹️ ▶️ Chris Latner why are you guys working on this, and why aren’t you working on some other syntactic sugar for the thing I want? And

⏹️ ▶️ Chris Latner of course, we could never tell them, but there was a good reason. And so another example

⏹️ ▶️ Chris Latner of that is the Object to See Literals feature. I think we introduced that in 2013, Firecall, for array

⏹️ ▶️ Chris Latner literals and other things like that. That

⏹️ ▶️ Chris Latner was an interesting feature in that it was a relatively small amount

⏹️ ▶️ Chris Latner of engineering work that brought the Objective-C language much closer

⏹️ ▶️ Chris Latner to Swift in terms of having arrays and dictionary literals as part of the language.

⏹️ ▶️ Chris Latner But the real reason for doing it is that it was a small amount of work that moved Objective-C forward which allowed

⏹️ ▶️ Chris Latner the compiler and language team to focus on Swift.

⏹️ ▶️ Chris Latner, Casey because

⏹️ ▶️ Chris Latner Swift was a very large amount of work and that was appeasing

⏹️ ▶️ Chris Latner the community and solving real problems, but buying time

⏹️ ▶️ Chris Latner to actually pour into the multi-year project of making the Swift language happen.

⏹️ ▶️ John That’s when you pull out the syntactic sugar. The

⏹️ ▶️ John, Chris Latner programmers love

⏹️ ▶️ John, Casey it. It takes 10 minutes

⏹️ ▶️ John to implement.

⏹️ ▶️ John, Casey Here you go.

⏹️ ▶️ John Everyone applauds when they see the slide. Yay. I mean, in all

⏹️ ▶️ Marco fairness, that was a really big deal.

Launch

⏹️ ▶️ Marco Anyway, so kind of building on the Apple internal reaction thing,

⏹️ ▶️ Marco you know, this language in its development and then its public release

⏹️ ▶️ Marco is probably a fairly unique language in the context in which it was released. You have this

⏹️ ▶️ Marco massive company. I mean, nobody probably had more Objective-C programmers than Apple does.

⏹️ ▶️ Marco And so you have this massive company with tons of internal programmers and a massive internal code base

⏹️ ▶️ Marco that is using this other language. You have this entire community of iOS

⏹️ ▶️ Marco and Mac developers, and then you have the entire world watching every move

⏹️ ▶️ Marco Apple makes and putting it under very, very heavy scrutiny. So the release of this language in

⏹️ ▶️ Marco this context is probably not only very high pressure, but also unique in that

⏹️ ▶️ Marco you knew that you were going to face a lot of people up front. Most languages probably start out with

⏹️ ▶️ Marco a few people using them in some random corner of internet and eventually maybe it slowly takes off.

⏹️ ▶️ Marco This was not that way. And so what considerations I guess went into that and also

⏹️ ▶️ Marco how were you able to convince people even inside of Apple to

⏹️ ▶️ Marco use Swift and how was that going?

⏹️ ▶️ Chris Latner So I guess there’s different answers to that for different phases.

⏹️ ▶️ Chris Latner We had no idea that the reaction would be as strong and

⏹️ ▶️ Chris Latner as positive as it was, and so I think we were blown away and caught unaware

⏹️ ▶️ Chris Latner in some ways. But in other ways I think we did the right thing. So for example,

⏹️ ▶️ Chris Latner if you look at Swift over time, Swift 1 and Swift 2 are as similar to Objective-C

⏹️ ▶️ Chris Latner as we can make them. So if you look at the way that selectors are named, for example,

⏹️ ▶️ Chris Latner it was very… a very direct correlation. If you look at the way Objective-C

⏹️ ▶️ Chris Latner or Swift 1 was explained to people, it was explained to people as

⏹️ ▶️ Chris Latner it’s just like Objective-C. You can use all your same patterns, you can use all the same frameworks, you can continue doing

⏹️ ▶️ Chris Latner object-oriented programming, you can do all these things. But it also has some cool new things like

⏹️ ▶️ Chris Latner enums and pattern matching and these other things. And so it’s great because

⏹️ ▶️ Chris Latner it’s just cleaned up syntax for what you already know, plus it has some new cool stuff that you can play with. Right?

⏹️ ▶️ Chris Latner And then you fast forward a year or two and the Swift community was really taking off.

⏹️ ▶️ Chris Latner It was, people were understanding what Swift was about. Swift open source also enabled

⏹️ ▶️ Chris Latner this. And Swift 3 is really about Swift becoming its own language that was really true

⏹️ ▶️ Chris Latner to itself and standing, you know, stands by itself. And that’s where you see

⏹️ ▶️ Chris Latner the method call syntax, for example, being radically changed. a lot of things just

⏹️ ▶️ Chris Latner kind of coming together and really focusing and polishing the language.

⏹️ ▶️ Chris Latner In terms of the rise of the community, the external community and people using it,

⏹️ ▶️ Chris Latner that was really, really hard for us because, so my experience had been

⏹️ ▶️ Chris Latner with LLVM and with Clang. Clang as a C and C++ compiler and Objective-C

⏹️ ▶️ Chris Latner was completely different than Swift because when we open sourced

⏹️ ▶️ Chris Latner and launched Clang, which was at Apple, everybody yawned.

⏹️ ▶️ Chris Latner, Casey We open

⏹️ ▶️ Chris Latner sourced it very early on and people said, okay, you’re nuts. Nobody can build a C++ compiler. That’s not a thing.

⏹️ ▶️ Chris Latner Why are you even messing around with this? And we got one contributor to the project

⏹️ ▶️ Chris Latner and we had no users. And then we got, a month later, we might get another contributor,

⏹️ ▶️ Chris Latner another person part-time sending in patches. And it was a very slow growth that

⏹️ ▶️ Chris Latner was ultimately really great because it was relatively low pressure. With Swift

⏹️ ▶️ Chris Latner and with the way it was launched, it was completely different because it went from

⏹️ ▶️ Chris Latner nobody knowing about it to everybody knowing about it overnight, literally, and there

⏹️ ▶️ Chris Latner being so much excitement, so many people that were nervous and had bad reactions, other people

⏹️ ▶️ Chris Latner that were super excited, but a lot of people that were suddenly hitting bugs and having challenges and problems,

⏹️ ▶️ Chris Latner and why did you do this, and why didn’t you do that? And some of that was misguided

⏹️ ▶️ Chris Latner just because they didn’t know Swift yet, but other aspects were really spot on, and

⏹️ ▶️ Chris Latner that was when we really started learning about how people were using and started iterating and moving Swift. And

⏹️ ▶️ Chris Latner Swift between the WWDC launch and Swift 1.0 release changed dramatically.

⏹️ ▶️ Chris Latner And that was a really, really hard time for the entire team because we really wanted to get

⏹️ ▶️ Chris Latner it as close as we could to what we wanted, but we had a very short amount of time to do so. And

⏹️ ▶️ Chris Latner I think that’s been true for SWF2 and SWF3 as well, where we have really high goals

⏹️ ▶️ Chris Latner for the team and really high goals for what we wanna get done, and that makes it

⏹️ ▶️ Chris Latner a lot of pressure and a lot of stress. But it’s, I think, worth it to

⏹️ ▶️ Chris Latner serve and see the community around SWF grow and see people use it

⏹️ ▶️ Chris Latner and see people learn it and it’s been a lot of fun.

Swift use by Apple

⏹️ ▶️ Marco So I’m curious, I know when Swift first came out, it was hard to get a lot of adoption

⏹️ ▶️ Marco inside of Apple for various tooling reasons, among maybe whatever else was

⏹️ ▶️ Marco going on. How is internal adoption going today? Are we seeing meaningful adoption

⏹️ ▶️ Marco now, or is it mostly iOS programmers who are using it and not anybody inside? The

⏹️ ▶️ Chris Latner Swift team itself has specific goals they need to achieve before there can be truly,

⏹️ ▶️ Chris Latner across the board adoption at Apple. ABI stability is the number one thing

⏹️ ▶️ Chris Latner that prevents framework developers, for example, from adopting Swift. So that’s a really

⏹️ ▶️ Chris Latner important thing, and that’s one of the reasons it’s always a really high priority. But Swift has been adopted

⏹️ ▶️ Chris Latner by application developers and other things. The Doc is public, Swift Playgrounds app

⏹️ ▶️ Chris Latner is public, the music app in iOS is publicly known. So there are definitely some big

⏹️ ▶️ Chris Latner adopters. More broadly, though, the big problem is is that I think,

⏹️ ▶️ Chris Latner I won’t speak for everybody, but many, many people doing object to see development

⏹️ ▶️ Chris Latner at Apple are chomping at the bit. They want to be using Swift, and so it’s really a matter of just getting the technology

⏹️ ▶️ Chris Latner problem solved and checking off the things that are holding people back. It’s not about

⏹️ ▶️ Chris Latner people dragging their feet and not wanting to use it. Makes sense.

⏹️ ▶️ Casey Yeah, that’s really awesome. From the outside, it’s so hard to figure out, is Apple

⏹️ ▶️ Casey internally like, ugh, really? Or is Apple internally, like you said, really excited? And I’m

⏹️ ▶️ Casey sure that there’s some of both, but that’s really good to hear.

⏹️ ▶️ Chris Latner Yeah, and I think it’s also changed over time. When Swift first came out, of course, it was a huge surprise

⏹️ ▶️ Chris Latner for most of the software team. And so, you know, many people went

⏹️ ▶️ Chris Latner through the usual phases of, I already know Objective-C, why would I learn this new thing? Objective-C

⏹️ ▶️ Chris Latner is great, and Objective-C is great. So that’s an objective statement, right?

⏹️ ▶️ Chris Latner But I think things have shifted over time, and as Swift has matured, it’s definitely become a

⏹️ ▶️ Chris Latner lot more appealing. One other technology problem that is hilarious, but

⏹️ ▶️ Chris Latner also really important is the Apple Framework stack has to support 32-bit

⏹️ ▶️ Chris Latner Mac apps. And 32-bit Mac apps have this interesting challenge of, they have what’s called

⏹️ ▶️ Chris Latner the classic Objective-C runtime, which doesn’t support things like non-fragile instance

⏹️ ▶️ Chris Latner variables and things like that. And so at some point in time, the Swift team will need to make the

⏹️ ▶️ Chris Latner Swift runtime work in that mode or figure out some other solution to adapt it

⏹️ ▶️ Chris Latner because until that happens, it won’t be possible to use Swift in AppKit, for example.

⏹️ ▶️ Casey Huh, that’s fascinating. So kind of taking a more broad

⏹️ ▶️ Casey view,

Transitional feelings

⏹️ ▶️ Casey Do you, could you name either your most proud accomplishment during your time at Apple that

⏹️ ▶️ Casey you can discuss publicly anyway? Or if not your most proud, just one, the first one that jumps to mind?

⏹️ ▶️ Casey Wow.

⏹️ ▶️ Chris Latner I don’t know, I’ve been really fortunate to work on so many really important projects.

⏹️ ▶️ Chris Latner And I mean, I think that between LLVM and Swift, for

⏹️ ▶️ Chris Latner example, it’s really a hard call. Swift, I think,

⏹️ ▶️ Chris Latner impacts more people in terms of the number of people that actually know they’re using it

⏹️ ▶️ Chris Latner and wanna learn it and things like that. But I think the LLVM has been picked up and used so far

⏹️ ▶️ Chris Latner across industry and it’s kind of standardizing the world’s compilers. I think that that’s probably

⏹️ ▶️ Chris Latner more profound at this point. So it’s really, it’s a hard call. I

⏹️ ▶️ Chris Latner mean, there are a ton of really, really

⏹️ ▶️ Chris Latner great opportunities that I’ve had and it’s been a lot of fun over many years now. Also, outside the open source

⏹️ ▶️ Chris Latner pieces, working with the Xcode team and working with the other teams and developer tools has been really

⏹️ ▶️ Chris Latner phenomenal. I mean, there’s so many great people at Apple and in developer tools, it’s just been a joy.

⏹️ ▶️ John So what do you expect to miss most about being at Apple? And I’m gonna let you

⏹️ ▶️ John expound on this, but I’m gonna take it off the table and say you have to pick your second choice. You’re gonna say you miss the people because of course

⏹️ ▶️ John you do, right? Yes,

⏹️ ▶️ John, Chris Latner that is actually what I would say.

⏹️ ▶️ John Right, but you know, so go ahead and tell us about all the great people you work with at Apple, But besides that, what do you expect

⏹️ ▶️ John to miss most about Apple, the company?

⏹️ ▶️ Chris Latner Well, so the great thing about Apple and the thing that I don’t think that many people

⏹️ ▶️ Chris Latner really get about Apple is that it is really one of the few best

⏹️ ▶️ Chris Latner places in the world where you can work hard, but also work on products that ship

⏹️ ▶️ Chris Latner and that ship to millions of people so that your hard work ends up mattering.

⏹️ ▶️ Chris Latner Right? There are a lot of places you can work hard. There’s a lot of places that you can

⏹️ ▶️ Chris Latner work on interesting things, but there’s also a lot of places that end up not shipping a lot.

⏹️ ▶️ Chris Latner Or if they ship it, very few people actually use it. And so Apple’s really, really magical

⏹️ ▶️ Chris Latner in that it combines being able to work hard and do great things

⏹️ ▶️ Chris Latner with it actually mattering. And to me, that’s the thing that is just so phenomenal

⏹️ ▶️ Chris Latner about Apple.

⏹️ ▶️ Marco So moving on to your new role at Tesla, do you think that Swift

⏹️ ▶️ Marco will still be a major part of your work life in some way? Or will it basically

⏹️ ▶️ Marco be something you do in the evenings and weekends? Because we all know that Silicon Valley tech startups don’t

⏹️ ▶️ Marco usually work people too hard, so you’re going to have tons of free time, right?

⏹️ ▶️ Chris Latner Yeah, so this jump I’m making is definitely do a cushy,

⏹️ ▶️ Chris Latner, Marco easy job with no stress.

⏹️ ▶️ Chris Latner, Casey That’s

⏹️ ▶️ Chris Latner That’s what I’m looking for here. So

⏹️ ▶️ Chris Latner I don’t know. We’ll have to see. I haven’t started yet and I think it’s going to be a very challenging job.

⏹️ ▶️ Chris Latner And one of the reasons I’m excited about it is because I really want to throw myself into another hard technology problem.

⏹️ ▶️ Chris Latner And so I’m really excited about that. I do expect to be involved with the design of Swift and

⏹️ ▶️ Chris Latner helping with the core team and helping Swift evolution process and helping in a lot

⏹️ ▶️ Chris Latner of that kind of respect. But one of the things to keep in mind is that Swift is actually a really

⏹️ ▶️ Chris Latner tiny slice of my job at Apple. And so, you know, I had

⏹️ ▶️ Chris Latner a very full schedule dealing with lots of other stuff and it was already kind of a nights and weekends

⏹️ ▶️ Chris Latner project that I was coding on it and contributing at the level that I was. So I’m hoping

⏹️ ▶️ Chris Latner that there won’t be a big change, but honestly, I’ll have to see. I care a lot

⏹️ ▶️ Chris Latner about Swift and I really want it to get to its goal of world domination. So…

⏹️ ▶️ Marco We’re sponsored tonight by Eero.

⏹️ ▶️ Marco go to Eero.com, that’s E-E-R-O.com, and use code ATP when you order for free

⏹️ ▶️ Marco extra shipping. Wi-Fi is broken. You probably have one Wi-Fi router with,

⏹️ ▶️ Marco if you’re lucky, a bunch of antennas on it that look hideous, and you’re trying to cover your whole house with Wi-Fi,

⏹️ ▶️ Marco but it just doesn’t reach every room. It just doesn’t reach everywhere because Wi-Fi is hard when you’re just covering

⏹️ ▶️ Marco it from one point. Eero solves this problem by having a router system where they will,

⏹️ ▶️ Marco they have this little Eero unit. It’s nice, it’s attractive, it’s It’s tastefully designed. There’s not a bunch of antenna sticking out of it.

⏹️ ▶️ Marco And you can buy one of them, or you can buy 10 of them, or any number in between. And you put

⏹️ ▶️ Marco them around your house, and each one covers the area in Wi-Fi, and they all talk to each

⏹️ ▶️ Marco other wirelessly. So you don’t have to run wires all over your house. You can have your entire house blanketed

⏹️ ▶️ Marco in Wi-Fi with Eero. And they talk to each other over this mesh network, so it’s even faster than previous,

⏹️ ▶️ Marco if you ever use like an extender, or anything else, extenders are very slow. It’s even faster than that by a lot. An Eero

⏹️ ▶️ Marco is true enterprise grade quality and performance. They have everything you need from encryption features

⏹️ ▶️ Marco to things like parental controls. And they’re actually updating it over time. They’ve done over 12 updates since launch

⏹️ ▶️ Marco with more to come to add features. They have an app for very easy setup and they have incredible

⏹️ ▶️ Marco customer support if you need it. They recommend one Eero per 1,000 square feet. So the typical home will have

⏹️ ▶️ Marco two or three of them. They got a three pack as a pretty reasonable starting point for almost everybody. There’s a 30 day

⏹️ ▶️ Marco money back guarantee if you don’t like it or if you just buy too many, you wanna return a couple of them if you end up not needing

⏹️ ▶️ Marco as many as you bought, check it out. The reviews are stellar. They back this up. Go to

⏹️ ▶️ Marco Eero.com, that’s E-E-R-O.com, and use code ATP when you order for

⏹️ ▶️ Marco free extradited shipping.

Open-sourcing

⏹️ ▶️ Marco Thank you very much to Eero for sponsoring our show.

⏹️ ▶️ Casey You know, obviously Swift is open source. I don’t know if you’re aware of that, Chris, but

⏹️ ▶️ Casey how do you feel like it’s been going so far and I’m assuming similar to John, you know, I’m going to take away

⏹️ ▶️ Casey the obvious answer of it’s going well, but maybe to kind of cue conversation,

⏹️ ▶️ Casey what’s been really surprising about going open source? you can get as specific or as

⏹️ ▶️ Casey broad as you’d like to be. But I got to imagine that you guys had a bunch of expectations

⏹️ ▶️ Casey about what going open source would be like. And I would imagine some of them were accurate and some of them weren’t. So how do you feel like the Swift

⏹️ ▶️ Casey open source project has been going?

⏹️ ▶️ Chris Latner Yeah, so I think that to summarize, it’s not just going well, it’s going

⏹️ ▶️ Chris Latner far better than we ever anticipated. And that caused problems.

⏹️ ▶️ Chris Latner So for context, I and many of the other people in the team and many of the other people on the

⏹️ ▶️ Chris Latner team had quite a bit of open source experience. So LLVM and Clang, for example, were open source.

⏹️ ▶️ Chris Latner They were, they are vibrant and amazing communities with

⏹️ ▶️ Chris Latner hundreds of contributors and dozens of companies all collaborating in public and doing really amazing stuff.

⏹️ ▶️ Chris Latner Even some of the most staunch competitors, you know, AMD and

⏹️ ▶️ Chris Latner Intel and AMD and Nvidia, or, you know, these kinds of companies that really

⏹️ ▶️ Chris Latner don’t get along on the business side of things, but the engineers were great at working engineer

⏹️ ▶️ Chris Latner to engineer and solving problems and staying focused on making things better.

⏹️ ▶️ Chris Latner So with Swift, we assumed that it would be very similar to that. But what

⏹️ ▶️ Chris Latner we found is that there was a major difference between launching Swift and launching something like Clang, for

⏹️ ▶️ Chris Latner example, which is that when Swift launches open source, which was December 3rd, just

⏹️ ▶️ Chris Latner over a year ago, it already had, I don’t know, a million users.

⏹️ ▶️ Chris Latner And where Clang started and everybody yawned and didn’t

⏹️ ▶️ Chris Latner really care and grew slowly, Swift open source started and was amazingly

⏹️ ▶️ Chris Latner fast moving, changing, tons of people, hundreds of patches on the first day. It was

⏹️ ▶️ Chris Latner totally crazy and we didn’t really know what to do. And so, I mean, I

⏹️ ▶️ Chris Latner am like super impressed with the Swift open source community and all the people involved and the energy. And

⏹️ ▶️ Chris Latner just, I mean, it’s just, it’s hard, it’s hard to believe how great everything is.

⏹️ ▶️ Chris Latner But it really did create problems because we had to figure out things like how are we gonna stay up on, in terms of

⏹️ ▶️ Chris Latner the patch volume? Okay, we’re getting hundreds and hundreds of emails a day to the Swift Evolution mailing list.

⏹️ ▶️ Chris Latner What are we going to do about that? How do we balance Apple’s goals

⏹️ ▶️ Chris Latner for pushing Swift forward with the goals of the community, which are somewhat more chaotic and less

⏹️ ▶️ Chris Latner directed. And I think that over the last year, we’ve learned a lot and you can see that reflect

⏹️ ▶️ Chris Latner in terms of how the project’s being managed and how things are being done.

⏹️ ▶️ Chris Latner But it’s always been super important to be not just open source, but

⏹️ ▶️ Chris Latner I guess if you look at an open source project, there’s three kind of easy levels to look at it.

⏹️ ▶️ Chris Latner The first basic requirement that you have to satisfy to be open source is to make your code available,

⏹️ ▶️ Chris Latner right? And so you can produce tarballs periodically, and that’s technically open source.

⏹️ ▶️ Chris Latner, Casey You can

⏹️ ▶️ Chris Latner allow contributions, and if you do that through pull requests or patches or whatever, then

⏹️ ▶️ Chris Latner people can engage with it and make the code better. There’s open community, so not

⏹️ ▶️ Chris Latner only do you accept a patch, but you actually discuss things and talk about things

⏹️ ▶️ Chris Latner in public. And then there’s open design. And with Swift, we went all the way, And I think it was totally

⏹️ ▶️ Chris Latner the right thing to do because we really wanted to benefit from all the smart people in the world. And

⏹️ ▶️ Chris Latner it was, and still is amazing, but it’s also very challenging.

⏹️ ▶️ Casey Yeah, I can imagine. So building upon the open sourcing of Swift,

⏹️ ▶️ Casey it was very surprising to me, and I think a lot of the community, that Apple chose to upload the

⏹️ ▶️ Casey entire commit history. It wasn’t just a, here’s day one, initial commit, and it’s 11 gazillion

⏹️ ▶️ Casey files and 80 gazillion lines of code. Was that planned from the start that you guys

⏹️ ▶️ Casey would upload the entire history?

⏹️ ▶️ Chris Latner I wouldn’t say it was planned from the start that we’d upload the entire history, but it was kind of assumed from the start

⏹️ ▶️ Chris Latner that it would be open source at some point. Interesting. And if you look at Apple’s history,

⏹️ ▶️ Chris Latner I think that’s, in the tool space, I think that’s fairly

⏹️ ▶️ Chris Latner straightforward. LLVM wasn’t started at Apple, but

⏹️ ▶️ Chris Latner almost everything Apple does ends up going public in the LLVM space. Clang

⏹️ ▶️ Chris Latner was started at Apple, and Clang was contributed by Apple to the LLVM project,

⏹️ ▶️ Chris Latner and that included its full revision history. Other projects like LDB

⏹️ ▶️ Chris Latner and libc++ and compiler RT and all these other smaller projects

⏹️ ▶️ Chris Latner were started at Apple and contributed to the open source project. So with Swift, it was kind of assumed that that would

⏹️ ▶️ Chris Latner happen at some point. The real question was, when is the right time for

⏹️ ▶️ Chris Latner that to happen? And if you remember the days of SWIFT 1.0, SWIFT 1.0

⏹️ ▶️ Chris Latner to 2.0 in particular was a super chaotic, super learning as we went

⏹️ ▶️ Chris Latner and trying to keep up with the community and trying to keep up with the pace and the challenges that people were facing and

⏹️ ▶️ Chris Latner trying to get key pieces like the air handling model and protocol extensions and all that kind of stuff that had always been planned, but

⏹️ ▶️ Chris Latner didn’t make it into SWIFT 1.0. And so really focusing on that was the priority. And so

⏹️ ▶️ Chris Latner we decided that open sourcing Swift at 1.0, for example, would be really actually

⏹️ ▶️ Chris Latner bad for the Swift community because there are major pieces of language that weren’t there.

⏹️ ▶️ Chris Latner We would have to spend a lot of time community building and trying to explain to people the difference between what

⏹️ ▶️ Chris Latner was not there but should be there and what is there and known broken. And

⏹️ ▶️ Chris Latner we had to do a lot of that when Swift was eventually open sourced in last year

⏹️ ▶️ Chris Latner right after Swift 2.0, but it was a much better place. and the team could actually handle the load of doing

⏹️ ▶️ Chris Latner the community. And we didn’t expect the kind of response that we got, but we knew that building a vibrant

⏹️ ▶️ Chris Latner open source community is a lot of work, and it’s not something to be underestimated. And we wanted to make sure

⏹️ ▶️ Chris Latner that Swift 2 was out the door, and it wasn’t kind of a resource contention between

⏹️ ▶️ Chris Latner do we finish Swift 2, or do we start open source? And that’s why it was announced

⏹️ ▶️ Chris Latner to be open source by the end of the year, because that meant that we could start working on the open source infrastructure

⏹️ ▶️ Chris Latner project, bringing up all the other stuff that it takes to make something open source after Swift 2 is complete.

⏹️ ▶️ John So my recollection of the Swift 3 in the planning stages was that ABI compatibility

⏹️ ▶️ John was somewhere in the list of, I don’t know if you want to call them goals, but

⏹️ ▶️ John somewhere in the list of items that were in contention for Swift 3. And at some point along the development

⏹️ ▶️ John process of Swift 3, ABI compatibility got postponed. And

⏹️ ▶️ John given what you just said about the importance of ABI compatibility for the framework people inside Apple or whatever,

⏹️ ▶️ John what can you say about that? Did you learn lessons from

⏹️ ▶️ John ABI compatibility being planned for Swift 3? Or do you think like it was never really a hard and fast

⏹️ ▶️ John goal and you totally made the right call to delay it or are you disappointed that it didn’t make it?

⏹️ ▶️ Chris Latner Well, I think many of those things. I mean, we’re disappointed that it got delayed, but it was totally the right thing.

⏹️ ▶️ Chris Latner I think that there’s a couple of things to learn from that. one of which is software schedule planning is hard.

⏹️ ▶️ Chris Latner, Casey Breaking

⏹️ ▶️ Chris Latner, Marco news.

⏹️ ▶️ Chris Latner Yeah, so that’s definitely still a thing. There’s also that we didn’t anticipate

⏹️ ▶️ Chris Latner the, so the original plan that you’re referring to was announced before Swift was open source,

⏹️ ▶️ Chris Latner or sorry, it was announced the same time Swift was open source. And so we had no idea that

⏹️ ▶️ Chris Latner the community would descend on Swift and suddenly have all these new demands and consume

⏹️ ▶️ Chris Latner so much time and energy that kind of took away from programming to do

⏹️ ▶️ Chris Latner the community building piece. So that was part of it. Another part of it is that ABI

⏹️ ▶️ Chris Latner stability is super important, but it’s not as important as people think it is for application

⏹️ ▶️ Chris Latner developers. It’s really important to Apple. But what we realized

⏹️ ▶️ Chris Latner in the Swift 3 timeframe is that the thing app developers would benefit from the most was

⏹️ ▶️ Chris Latner actually source stability. So who actually wants their application to be broken

⏹️ ▶️ Chris Latner when they get a new version of Xcode? Well, really nobody, right?

⏹️ ▶️ Chris Latner And so kind of halfway through the release, we pivoted and source stability became the goal.

⏹️ ▶️ Chris Latner And so I’m really excited that when Swift 3.1 or Swift 4 comes out, that

⏹️ ▶️ Chris Latner it’s still gonna be able to build Swift 3 code. And even if there are minor changes

⏹️ ▶️ Chris Latner that need to be made for one reason or another, that you can upgrade and you have

⏹️ ▶️ Chris Latner great compatibility with your old code and you don’t have to start the migrator before you can do anything. So

⏹️ ▶️ Chris Latner it’s going to be a great improvement for people’s lives.

Server-side Swift

⏹️ ▶️ Marco Alright, so moving on a little bit to this branch topic here of

⏹️ ▶️ Marco server-side Swift, Swift on Linux, things like this. Is

⏹️ ▶️ Marco Swift on the server something that… I know it’s possible and there’s

⏹️ ▶️ Marco seemingly some early efforts now to get that going. Do you see this as a major

⏹️ ▶️ Marco goal for Swift as the language? And not in any kind of official capacity, but just you as a person

⏹️ ▶️ Marco who likes and uses Swift and has a strong role in the community,

⏹️ ▶️ Marco is server-side Swift a thing that you want to be a major thing

⏹️ ▶️ Marco to compete with things like Python and Rails and stuff on the server? Or is it

⏹️ ▶️ Marco intended more to be a specialized thing that is probably not going to be in widespread use by

⏹️ ▶️ Marco web and backend programmers?

⏹️ ▶️ Chris Latner So I think that everybody involved with the project wants it to be the way

⏹️ ▶️ Chris Latner to do server development.

⏹️ ▶️ Chris Latner, Casey And

⏹️ ▶️ Chris Latner I think that to understand that, you have to understand we’re just kind

⏹️ ▶️ Chris Latner of entering phase two of Swift’s world domination plan.

⏹️ ▶️ Chris Latner So this will probably sound insane, but maybe in a few years it will sound less

⏹️ ▶️ Chris Latner insane. But the way I look at it, and the way that many other

⏹️ ▶️ Chris Latner people at Apple look at it, is that we want Swift to be the next big thing, right?

⏹️ ▶️ Chris Latner We want it to be more popular than Java was or is. We want it to be more popular than Python. We want it to be

⏹️ ▶️ Chris Latner maybe even more popular than C someday. That would be a stretch, but that

⏹️ ▶️ Chris Latner would be great, right? And so if that’s the problem to solve, how do you solve that problem? Well,

⏹️ ▶️ Chris Latner open source is a huge piece of that, right? Without open source, it’s not going to be available on other people’s platforms. It’s

⏹️ ▶️ Chris Latner not gonna be used in education and teaching. that’s just not gonna happen. And so open source is

⏹️ ▶️ Chris Latner a major piece of that. If you go back farther, before that, Swift

⏹️ ▶️ Chris Latner world domination doesn’t happen unless Swift gains relevance, right? And

⏹️ ▶️ Chris Latner I think Swift has nailed the relevance side of things with the iOS and Apple platform

⏹️ ▶️ Chris Latner development side of the story where, you know, maybe not Marco,

⏹️ ▶️ Chris Latner but

⏹️ ▶️ Chris Latner, Casey most

⏹️ ▶️ Chris Latner, Marco other people are switching to

⏹️ ▶️ Chris Latner Swift very quickly and seem very happy using it.

⏹️ ▶️ Marco Actually, I started using it today. Okay, good call. I switched

⏹️ ▶️ Marco, Chris Latner today in

⏹️ ▶️ Marco honor of this interview. I wrote my first Swift today, and an entire extension

⏹️ ▶️ Marco in Overcast 3.0 is written in Swift.

⏹️ ▶️ Casey Wow! See, fantastic. Look at you go, I’m proud of you.

⏹️ ▶️ Chris Latner It is a good day. Yeah,

⏹️ ▶️ Chris Latner, Marco and

⏹️ ▶️ Marco more will be coming. Although, there’s a lot of Objective-C there, so I’m probably a long way away

⏹️ ▶️ Marco from it being all Swift. Yeah, well,

⏹️ ▶️ Chris Latner that’s okay. Swift loves Objective-C. Exactly. So the way I look at it is that the

⏹️ ▶️ Chris Latner first step of Swift world domination is getting to relevance. And for a language to

⏹️ ▶️ Chris Latner get to relevance, it needs a killer app, right? It needs a reason why people would want to use it. And

⏹️ ▶️ Chris Latner for Swift, that’s clearly iOS and Mac and other Apple platform development.

⏹️ ▶️ Chris Latner Second, it needs to be open source. Third, it needs to go beyond,

⏹️ ▶️ Chris Latner right? And the next step, the frontier of where it makes sense to expand out to, or if you’re,

⏹️ ▶️ Chris Latner you know, real-time strategy, game player, the natural expansion is a place

⏹️ ▶️ Chris Latner where the language is, where the language

⏹️ ▶️ Chris Latner actually only needs a few things added to it to be good. And so I think server development

⏹️ ▶️ Chris Latner is really that next step because server development is very similar to app development in terms of the kinds of code that

⏹️ ▶️ Chris Latner you need to write. It’s very similar in terms of many of the frameworks. The major missing piece

⏹️ ▶️ Chris Latner is that it needs to run on Linux and other pertinent server development platforms,

⏹️ ▶️ Chris Latner and there’s then the whole library ecosystem that needs to be built out. And so I

⏹️ ▶️ Chris Latner think that what we’re in right now is we’re in a really exciting phase where those platforms are being

⏹️ ▶️ Chris Latner built, those frameworks and different pieces of infrastructure are coming together, and

⏹️ ▶️ Chris Latner that’s really the idea behind the Swift server working group that’s an official part of Swift.org is

⏹️ ▶️ Chris Latner getting all the people working in the space to talk to each other, and I’m very excited about that.

⏹️ ▶️ Chris Latner Going beyond that though, with the goal of being more relevant than Java, for

⏹️ ▶️ Chris Latner example, if we’re gonna pick on Java, the dream of Swift

⏹️ ▶️ Chris Latner is to scale all the way from scripting language all the way down to low-level systems

⏹️ ▶️ Chris Latner programming, like you could write a kernel in it, or you write some firmware in it. And I think the

⏹️ ▶️ Chris Latner scripting side of it is maybe more straightforward when the

⏹️ ▶️ Chris Latner Swift community and the core team have time to deal with it, because there you’re talking about

⏹️ ▶️ Chris Latner integrating regular expressions, integrating multi-line string literals, and integrating other features

⏹️ ▶️ Chris Latner like that that people love from scripting languages. And those are big projects,

⏹️ ▶️ Chris Latner but those are kind of well-known, I

⏹️ ▶️ Chris Latner, Marco guess,

⏹️ ▶️ Chris Latner and they will fit and drop right into the existing system

⏹️ ▶️ Chris Latner that Swift provides. Systems programming is, I think, the big

⏹️ ▶️ Chris Latner next frontier. And I think that’s where Swift can really distinguish itself from Java or

⏹️ ▶️ Chris Latner other competitive languages because among other widely used languages

⏹️ ▶️ Chris Latner out there, there’s really nothing that can unseat C or C++. There’s Rust,

⏹️ ▶️ Chris Latner for example, is an interesting language, but it hasn’t gotten a lot of adoption yet. And I think that

⏹️ ▶️ Chris Latner Swift is more interesting than Rust in some of the higher level application domains.

⏹️ ▶️ Chris Latner But we’ll see, Rust is a great language as well. And so I’m really interested to see

⏹️ ▶️ Chris Latner the Swift for systems programming work get going. And I think that’ll

⏹️ ▶️ Chris Latner be a couple of years out before it really comes together. But once it does, I think that Swift

⏹️ ▶️ Chris Latner can be, really be the next big thing. And I’m excited about that.

⏹️ ▶️ Marco So just stepping back a second to the server role of it possibly taking over there. Because

⏹️ ▶️ Marco I would love, here I am using PHP and Objective-C, these two languages that are fairly

⏹️ ▶️ Marco old. And, I mean, PHP is way more hated than Objective-C. But these

⏹️ ▶️ Marco are the two languages I use for various historical and practical reasons.

⏹️ ▶️ Marco On the server, a lot of what makes a language succeed or fail

⏹️ ▶️ Marco on servers and in web development is not necessarily how good of a language it is,

⏹️ ▶️ Marco but how healthy and universal and developed the frameworks

⏹️ ▶️ Marco around it are for things like web development, how practical and easy it is to deploy

⏹️ ▶️ Marco and run on servers. So, you know, Swift being its

⏹️ ▶️ Marco own good language, that alone I don’t think is enough to get it to get

⏹️ ▶️ Marco traction on the server. Like, do you think, is it necessary for

⏹️ ▶️ Marco the Swift team, like the core group who’s running Swift, whether that’s

⏹️ ▶️ Marco Apple or the community of contributors with Apple or whatever else, is it important for them

⏹️ ▶️ Marco to develop and kind of make an official set of server

⏹️ ▶️ Marco and web frameworks and libraries and tools? Or do you think it’s sufficient

⏹️ ▶️ Marco to kind of take the risk to let the community do that, but at the risk of fragmentation and maybe nothing ever

⏹️ ▶️ Marco taking off?

⏹️ ▶️ Chris Latner Well, so that’s an interesting question. And keep in mind that I don’t have a lot of practical experience building

⏹️ ▶️ Chris Latner server apps. So this is… You’re not missing much. My opinion

⏹️ ▶️ Chris Latner based on talking to other smart people. So the approach the Swift project is taking

⏹️ ▶️ Chris Latner is it’s looking to standardize what’s colloquially but not correctly known

⏹️ ▶️ Chris Latner as server foundation kind of technologies. So it will not be named server foundation, but

⏹️ ▶️ Chris Latner that kind of an idea. And so take the encryption, the network transport, the HTTP kinds

⏹️ ▶️ Chris Latner of things that everybody needs for server technologies and standardize that as part

⏹️ ▶️ Chris Latner of the Swift project, but at least in the short term, not look to standardize a specific web framework.

⏹️ ▶️ Chris Latner Because there are half a dozen different, completely different approaches that are interesting in different

⏹️ ▶️ Chris Latner kind of demands. And I don’t think there’s a clear winner yet. It’s possible

⏹️ ▶️ Chris Latner that after the first few rounds shake out, then there will be an equivalent Ruby

⏹️ ▶️ Chris Latner on Rails kind of dominant pattern and framework that emerges.

⏹️ ▶️ Chris Latner And if so, then maybe that would make sense. But I don’t think Swift needs for there to be

⏹️ ▶️ Chris Latner a winner at the high level. As far as what can the Swift core

⏹️ ▶️ Chris Latner language and language and compiler folks do about this, I think there’s really two

⏹️ ▶️ Chris Latner things. One of which is the Swift Package Manager. I think the Package Manager is really key to

⏹️ ▶️ Chris Latner scaling out the ecosystem and getting people to work together

⏹️ ▶️ Chris Latner with the common ecosystem. It’s also the best and I think only way to build Swift code on Linux

⏹️ ▶️ Chris Latner and other platforms. I don’t mean to single out Linux, it’s just the biggest

⏹️ ▶️ Chris Latner server development one. So I think that’s a big piece. I think the other piece that will be

⏹️ ▶️ Chris Latner really amazing is when the concurrency model comes up because I think that’s one of the reasons that makes

⏹️ ▶️ Chris Latner Go particularly compelling for server development is it has a really well-developed story there along

⏹️ ▶️ Chris Latner with all the libraries that go together for server and cloud development. And so when the pieces

⏹️ ▶️ Chris Latner of the concurrency model start coming up, which will probably, the first pieces will ship in Swift 5 is my guess,

⏹️ ▶️ Chris Latner that will make Swift an even more compelling kind of answer for that kind of space.

⏹️ ▶️ Chris Latner But I don’t think we need a server language feature if that’s what you’re asking.

Low to high, easy to hard

⏹️ ▶️ John So going to the other extreme from the server side and scripting to getting back to

⏹️ ▶️ John systems programming one thing I’ve seen Related to this and and I think this

⏹️ ▶️ John all stems from like this quote from the original Apple Swift book that Swift was

⏹️ ▶️ John designed to scale from hello world to an entire operating system like that that it’s the world domination Plan was there

⏹️ ▶️ John from the beginning, right? Yep.

⏹️ ▶️ John, Chris Latner Yeah, absolutely

⏹️ ▶️ John in the first paragraph of the thing When I talk to people now about

⏹️ ▶️ John about Swift as a systems language. Often what I hear is

⏹️ ▶️ John people relating the ways that it is not ready to be a systems language yet, which is,

⏹️ ▶️ John you know, what you just talked about, but then deciding based on that, that because it’s not ready

⏹️ ▶️ John to be a systems language now, it never will, and then they dismiss it. Like, in other words, like,

⏹️ ▶️ John that may have been the plan, but clearly, for reasons X, Y, and Z,

⏹️ ▶️ John you still have to use C for this, this. Therefore, Swift is just a way to write apps for iOS and Mac

⏹️ ▶️ John OS. And how I mean, I’m not quite sure what you can do with that. But do you think

⏹️ ▶️ John about how how to change perception as the language

⏹️ ▶️ John gets older and it’s old age now it’s up to 3.0 like that it starts to you know that that nobody puts

⏹️ ▶️ John Swift in a corner like that that people think they know people think they know what Swift is and they say oh it’s this

⏹️ ▶️ John language that does this thing and that your plans for world domination may be thwarted by the idea that

⏹️ ▶️ John people are pigeonholing language because it’s been around for a few years and I think they know it.

⏹️ ▶️ Chris Latner I think that you’re onto something. I think that’s a real problem. I don’t think systems programming is the place where that’s a problem yet though,

⏹️ ▶️ Chris Latner because I don’t think it’s reasonable for me as a crazy man going

⏹️ ▶️ Chris Latner around saying, Swift will someday do systems programming really well. You should remember that.

⏹️ ▶️ Chris Latner I don’t think that’s a good way to spend time at the moment. When it does that, Then

⏹️ ▶️ Chris Latner the question becomes how do you make that, make people aware of that and how

⏹️ ▶️ Chris Latner do you get people to change their prior misconception. But at that point in time you can have a very

⏹️ ▶️ Chris Latner practical, look, you can do this and this is so great. And now you get all the advantages of C but

⏹️ ▶️ Chris Latner it’s safe and you can point to specific reasons why it’s better.

⏹️ ▶️ Chris Latner So I’m not too worried about it in the space of systems programming but I think there is a practical problem

⏹️ ▶️ Chris Latner today which is Swift is open source. The

⏹️ ▶️ Chris Latner Apple development community knows Swift very well, but pretty much everybody else doesn’t,

⏹️ ▶️ Chris Latner right? And if you go to a random, say, Linux

⏹️ ▶️ Chris Latner developer, just to continue talking about Linux, they all perceive Swift as

⏹️ ▶️ Chris Latner being an Apple thing and only relevant to Apple platforms, and they don’t even learn about it,

⏹️ ▶️ Chris Latner right? And so I think that there is an interesting challenge there and probably

⏹️ ▶️ Chris Latner the best way to do that is for the existing communities

⏹️ ▶️ Chris Latner to keep just growing. And as the Swift on Server community grows

⏹️ ▶️ Chris Latner and more and more people are successful building and deploying server apps in Swift, I hope that

⏹️ ▶️ Chris Latner naturally more and more people will become aware of that effort, will then find

⏹️ ▶️ Chris Latner out about Swift, maybe try it out, find out that it’s actually really great. And if it’s not

⏹️ ▶️ Chris Latner really great, let us know so that people can fix whatever the problems are and then just kind

⏹️ ▶️ Chris Latner of grow out. But I’m actually perfectly OK with it growing a little bit slower than it has been.

⏹️ ▶️ Marco So John asked about the span between basically low-level systems programming and high-level applications

⏹️ ▶️ Marco programming. I’m also curious that it seems like the Swift team slash Apple have

⏹️ ▶️ Marco presented Swift as not only spanning that wide range, which seems impossible,

⏹️ ▶️ Marco but also spanning a wide range of skill levels of programmers. So there’s the Swift Playgrounds

⏹️ ▶️ Marco app on iPad where you have total novices writing Swift as their first language, all the way up

⏹️ ▶️ Marco to people writing systems-level things and complicated apps who

⏹️ ▶️ Marco are very experienced programmers. Do you think—is it possible for a

⏹️ ▶️ Marco language to do all of these things well? And if so, do you think Swift has achieved

⏹️ ▶️ Marco that?

⏹️ ▶️ Chris Latner So I do think it’s possible. I think it has achieved it for the things that it’s

⏹️ ▶️ Chris Latner doing so far. And I think the challenge is that as new capabilities get added, that it doesn’t jeopardize

⏹️ ▶️ Chris Latner that. But knowing the folks involved and the source compatibility

⏹️ ▶️ Chris Latner guarantees and everything else like that, I’m pretty sure that won’t be a problem going forward. Here’s the way I look at

⏹️ ▶️ Chris Latner it. Swift, you will never, or you’re unlikely to run to anybody that says that Swift

⏹️ ▶️ Chris Latner is a simple language. Right? Swift is a complicated language. It’s not simple

⏹️ ▶️ Chris Latner in the sense that Scheme is simple, for example. It’s also not simple in terms of

⏹️ ▶️ Chris Latner when you talk to an Objective-C developer, they’ll often claim that Objective-C is simple, ignoring all the C

⏹️ ▶️ Chris Latner parts. I would never claim that, for the record. So C itself is

⏹️ ▶️ Chris Latner a very complicated, weird language. It’s just that people don’t typically use the weird parts,

⏹️ ▶️ Chris Latner right? And so they perceive C as being very simple. So the way

⏹️ ▶️ Chris Latner I project this onto Swift is that the secret to Swift in being easy to learn,

⏹️ ▶️ Chris Latner easy to use as a teaching vehicle, but also powerful enough to

⏹️ ▶️ Chris Latner solve the problems that need to be solved is that the complexity inherent in the language needs to be progressively

⏹️ ▶️ Chris Latner disclosed. So imagine if someday Swift had inline assembly support, for example.

⏹️ ▶️ Chris Latner Only really low-level systems people or really bit twiddling assembly programmers would use this feature,

⏹️ ▶️ Chris Latner everybody else would ignore it, and it would not increase the apparent complexity of the language to people

⏹️ ▶️ Chris Latner who didn’t know what it was. For a feature like that, the most important thing is to make the syntax clear so that

⏹️ ▶️ Chris Latner when you run up into it, you discover somebody else’s code, you know that you don’t know what it does.

⏹️ ▶️ Chris Latner Right? And so you say, ah, that’s interesting, I don’t know what that is, and then you can do

⏹️ ▶️ Chris Latner a search and find out, find the Stack Overflow article, whatever it is, to say, explain what this is to me. And

⏹️ ▶️ Chris Latner then you can say, oh, OK, I get it. And I either care or I don’t. But at that point in time, you can then dive in

⏹️ ▶️ Chris Latner and learn more information. Assembly is never something that a Swift Playgrounds

⏹️ ▶️ Chris Latner person working through Learn to Code 3 would ever want to know about. And I

⏹️ ▶️ Chris Latner think that is really one of the secrets to Swift’s success in terms of getting people

⏹️ ▶️ Chris Latner on board and being really approachable for people at all levels is that

⏹️ ▶️ Chris Latner just like in Python, you can start with just print hello world, you could do the exact same thing in Swift. And

⏹️ ▶️ Chris Latner with Swift, you don’t need the slash end on your string. It’s really just print hello world.

⏹️ ▶️ Chris Latner And from there, you can then introduce new concepts. You can grow it out over time. And this really allows

⏹️ ▶️ Chris Latner people to understand either the syntax of language or the conceptual

⏹️ ▶️ Chris Latner programming things that they’re learning as they go. And the design of Swift is

⏹️ ▶️ Chris Latner really geared around that. And so what that means if you project on a system’s programming features, comparing

⏹️ ▶️ Chris Latner Swift to Rust, for example, I think it’s very likely that Swift will get features

⏹️ ▶️ Chris Latner for memory ownership control, which will allow really, really high performance. It’ll

⏹️ ▶️ Chris Latner allow solving performance problems with Arc, for example. But unlike Rust, we can’t

⏹️ ▶️ Chris Latner make that be a core part of the type system that everybody has to use. It has to be something

⏹️ ▶️ Chris Latner that sufficiently smart programmers, when they’re solving a specific performance problem,

⏹️ ▶️ Chris Latner end up using or an embedded kernel programmer might want to use, but an application

⏹️ ▶️ Chris Latner developer can completely ignore. And so that’s really the challenge is it’s a deploying

⏹️ ▶️ Chris Latner similar type system mechanics and other low level language geekery to the problem,

⏹️ ▶️ Chris Latner but do so in a way that is tasteful and allows most normal people to just completely ignore it.

⏹️ ▶️ John Everything you just said kind of reminds me of a saying I once heard that you’re free to adopt for Swift if you

⏹️ ▶️ John would like, which is make easy things easy and make hard things possible.

⏹️ ▶️ Marco We’re sponsored tonight by audible.

⏹️ ▶️ Marco With an unmatched selection of audiobooks, original audio shows, news, comedy, and more,

⏹️ ▶️ Marco get a free 30-day trial at audible.com. If you want to listen

⏹️ ▶️ Marco to what Audible has at you can listen to audiobooks from virtually every genre anytime, anywhere. You can

⏹️ ▶️ Marco play Audible’s audiobooks on phones, tablets, computers, even Kindles and iPods if you still

⏹️ ▶️ Marco have them. Audiobooks are great for flights, long road trips, or even your daily commute.

⏹️ ▶️ Marco You might think you don’t have time to read books, but you’d be surprised how many audiobooks you can hear each year, even only

⏹️ ▶️ Marco listening to and from work every day. That time really adds up. Audiobooks bring books to life.

⏹️ ▶️ Marco Many of them are read by authors themselves, which adds an extra dimension to the text. And with Audible, you

⏹️ ▶️ Marco can take risks and try new authors without regret, because Audible offers their great listen

⏹️ ▶️ Marco guarantee. If you start an audiobook and don’t like it, you can exchange it for another one for free.

⏹️ ▶️ Marco So check it out for yourself. You can see and listen. When you begin your free 30-day trial, you get your

⏹️ ▶️ Marco first audiobook for free. There’s no stress and no obligation because you can cancel your Audible membership at

⏹️ ▶️ Marco any time. So with audiobooks and spoken word audio products, you will find what you’re looking for.

⏹️ ▶️ Marco Get a free 30-day trial by signing up at audible.com slash ATP.

⏹️ ▶️ Marco That’s audible.com slash ATP.

Influences

⏹️ ▶️ Marco Thanks to Audible for sponsoring our show.

⏹️ ▶️ Casey So, Chris, you brought up just a second ago how simple Python’s hello world is.

⏹️ ▶️ Casey And one of the things I’ve wondered about Swift is it seems to some degree

⏹️ ▶️ Casey like it’s kind of the, what do you call it, the Rorschach test of languages in that I came to Swift

⏹️ ▶️ Casey a sort of, kind of via Objective-C, but my day job was as a C-sharp guy.

⏹️ ▶️ Casey I see, to my eyes anyway, and I hope you don’t find this insulting, but I see a lot of C sharp.

⏹️ ▶️ Casey I see a lot of C sharp in Swift. And I’ve heard JavaScript people, again, I hope that’s not insulting, say, oh, I see some JavaScript in

⏹️ ▶️ Casey here. And I presume that John could say that he sees Perl in it. I presume Marco could say that he sees PHP

⏹️ ▶️ Casey in it.

⏹️ ▶️ Casey, Marco Again,

⏹️ ▶️ Casey hopefully that’s not insulting.

⏹️ ▶️ Casey, Marco I see Go in it. I don’t see any

⏹️ ▶️ Marco PHP

⏹️ ▶️ Marco, Casey in it. Okay, fair enough.

⏹️ ▶️ Casey You get what I’m driving at, though. And so I guess what I’m asking, Chris, is obviously there

⏹️ ▶️ Casey was a huge Objective-C influence in Swift. But was there any one or maybe just a couple of other

⏹️ ▶️ Casey languages that you feel really, really inspired Swift? Or do you really think it’s the melting pot

⏹️ ▶️ Casey language that one would always hope to create?

⏹️ ▶️ Chris Latner I think it really is a melting pot because we weren’t… So the goal of Swift isn’t to ape some

⏹️ ▶️ Chris Latner other language. The goal of Swift is to

⏹️ ▶️ Chris Latner, Casey just be great,

⏹️ ▶️ Chris Latner right? And so you can take… I think that Swift looks,

⏹️ ▶️ Chris Latner or I and the other people on the core team and the other people working on Swift have looked at

⏹️ ▶️ Chris Latner many, many other languages. If you’re a Haskell nerd, there’s tons of Haskell concepts

⏹️ ▶️ Chris Latner built in. Protocols really are just like a very similar Haskell construct,

⏹️ ▶️ Chris Latner for example. And so it’s really about taking the best ideas from where

⏹️ ▶️ Chris Latner we can get and assembling them together. And one of the major goals of Swift is for it to be familiar

⏹️ ▶️ Chris Latner feeling, right? Because if it’s

⏹️ ▶️ Chris Latner, John familiar

⏹️ ▶️ Chris Latner feeling, that makes it easier for people to pick up and they’re They’re not fighting

⏹️ ▶️ Chris Latner unnecessary barriers to just get in the way of adoption. And so it being

⏹️ ▶️ Chris Latner familiar is actually success in that way.

⏹️ ▶️ Chris Latner, John And

⏹️ ▶️ Chris Latner it’s not a result of Swift trying to be Go or C Sharp

⏹️ ▶️ Chris Latner or whatever, it’s about taking the best ideas from them and assembling them together. And I think

⏹️ ▶️ Chris Latner that you could probably pick a language and there’s some good idea that came from them, including

⏹️ ▶️ Chris Latner D or Dart or Go or whatever. I mean, Swift does

⏹️ ▶️ Chris Latner really draw from many, many different sources and it’s really hard to

⏹️ ▶️ Chris Latner really tease them all out.

Why adopt now?

⏹️ ▶️ Marco So the question that Casey wrote for me to ask you right now

⏹️ ▶️ Marco, Casey is

⏹️ ▶️ Marco how do you know that was me? That’s definitely you is Why should I give a shit about Swift

⏹️ ▶️ Marco right now? And I think I’m gonna modify this a little

⏹️ ▶️ Casey That was written that was written for you my friend,

⏹️ ▶️ Casey, Marco but yes, I figure that’s not quite John style

⏹️ ▶️ Marco No, but but I you know as as somebody who is just dipping a toe

⏹️ ▶️ Marco in Swift, you know as of 12 hours ago ago, and has waited this long.

⏹️ ▶️ Marco Objective-C faithful, slash holdout, slash lazy people who don’t like learning new things very quickly.

⏹️ ▶️ Marco What’s the sales pitch for adopting Swift now?

⏹️ ▶️ Chris Latner I guess two different answers. One of which is, you don’t have to adopt Swift. I don’t think Objective-C

⏹️ ▶️ Chris Latner is gonna go away anytime soon. Apple still supports C and C++, and it doesn’t

⏹️ ▶️ Chris Latner have any specific, there’s no obvious benefit of dropping Objective-C,

⏹️ ▶️ Chris Latner as well as obviously they have a ton of Objective-C code themselves. So I don’t think that there’s any reason

⏹️ ▶️ Chris Latner you have to adopt Swift. Swift just tries to be a better answer so that

⏹️ ▶️ Chris Latner you’ll want to adopt it. And in terms of why, Swift

⏹️ ▶️ Chris Latner in its name kind of is connotes a whole bunch of different things, including performance. But

⏹️ ▶️ Chris Latner really to me, the most important aspect of it is programmer productivity, right? The idea that Swift is

⏹️ ▶️ Chris Latner really optimizing for is not letting you pound out the code as fast as possible. It really

⏹️ ▶️ Chris Latner is designed and optimized for, as a programmer, you can spend the least amount of time to get to

⏹️ ▶️ Chris Latner a working program as fast as possible. And so getting to a working program

⏹️ ▶️ Chris Latner includes the time it takes to debug something, includes the time it takes to iterate and develop and

⏹️ ▶️ Chris Latner fight the type system and all the other things that you have to do. But that time

⏹️ ▶️ Chris Latner you spend having to fight the type system or figure out optionals or things like that pays itself

⏹️ ▶️ Chris Latner back because your program works more often. And so you’re actually not spending time chasing down

⏹️ ▶️ Chris Latner dangling pointer bugs, or in the case of Objective-C,

⏹️ ▶️ Chris Latner you get an unrecognized selector error, you know, whatever those kinds of bugs are.

⏹️ ▶️ Chris Latner And Swift tries to help you by the language guiding you and helping design things. Swift

⏹️ ▶️ Chris Latner also has a lot of things that just make common things easier. So you can switch on a string, for example,

⏹️ ▶️ Chris Latner and then match the different cases. You can use enums, which are a super,

⏹️ ▶️ Chris Latner enums are just from the language geekery world of just algebraic data types. They’re in tons

⏹️ ▶️ Chris Latner of different functional languages. They’re not novel by any means, but they’re so useful,

⏹️ ▶️ Chris Latner and they solve so many problems just out of the box. And just having them at your fingertips is great.

⏹️ ▶️ Chris Latner So there’s a lot of things about Swift, and it probably depends on who you are, what your experiences are.

⏹️ ▶️ Chris Latner One of the problems I’ve seen with people moving from Objective-C to Swift initially is that they tend to write Swift code

⏹️ ▶️ Chris Latner just like they wrote Objective-C. And while that’s a really good way to maybe migrate an application

⏹️ ▶️ Chris Latner over or to get familiar with Swift, it really means that you’re missing a lot of the value in Swift.

⏹️ ▶️ Chris Latner And I think that that’s okay. It’s just, it means that, you know, an Objective-C programmer

⏹️ ▶️ Chris Latner going to Swift first starts out by saying, I don’t see what the big deal is. And only after they

⏹️ ▶️ Chris Latner spend some time in it do they start to realize they are more productive, they do feel better,

⏹️ ▶️ Chris Latner they reach for things that they otherwise wouldn’t have. And I think it’s really interesting

⏹️ ▶️ Chris Latner to talk to people that have done, for example, a year of Swift programming, but then have to go back to Objective-C.

⏹️ ▶️ Chris Latner And to me, that’s the really interesting thing. So what was your experience?

⏹️ ▶️ Casey It felt absolutely archaic. And granted, I like to think of myself as a nice guy,

⏹️ ▶️ Casey and so I’d probably say something like that even if it wasn’t true. But the reality of the situation is, it felt just

⏹️ ▶️ Casey so old. It just felt old. And I don’t know, I wish I could quantify

⏹️ ▶️ Casey that better, but it just felt like I was back in time in a way that didn’t

⏹️ ▶️ Casey feel good. And in some ways, it was kind of nice. So I do

⏹️ ▶️ Casey like optionals. I understand why they’re a thing. I am all in on it.

⏹️ ▶️ Casey But at the same time, there are times when I have to do a guard let or whatever the case may be that I really would just like to

⏹️ ▶️ Casey move on with my life. And so not having to worry, being able to be a little more

⏹️ ▶️ Casey cavalier was kind of nice. But the reality of the situation is, as you’ve said earlier,

⏹️ ▶️ Casey is that that’s a potential hazard down the road. And that’s why I like the way that you

⏹️ ▶️ Casey and the team have set up the type system in Swift. But gosh, going back to Objective-C

⏹️ ▶️ Casey is so frustrating for me because it just feels like I’m going back in time, like I’m going backwards.

⏹️ ▶️ Chris Latner, Casey Yeah,

⏹️ ▶️ Chris Latner and I think that the challenge that Swift faces is because this focus is on building, you know,

⏹️ ▶️ Chris Latner programs that work and that can be maintained and all the other things that we care about for large

⏹️ ▶️ Chris Latner scale software. It’s maybe not the best solution for

⏹️ ▶️ Chris Latner I want to pound out a quick script, use it once and then throw it away, right? Because

⏹️ ▶️ Chris Latner in that case, you don’t care about maintenance. You can fit all the code in your head. you don’t care about

⏹️ ▶️ Chris Latner good documentation or the other things that Swift encourages. And that’s a case where having a dynamic

⏹️ ▶️ Chris Latner type system can be really liberating. And so,

⏹️ ▶️ Chris Latner you know, maybe that’ll be a challenge for some people. But I think that as Swift gains ecosystem and gains

⏹️ ▶️ Chris Latner libraries, its other advantages will be so great that hopefully it will be

⏹️ ▶️ Chris Latner a good solution for those kinds of tools as well, those kinds of scripts as well.

Style and idioms

⏹️ ▶️ Marco So a minute ago you mentioned how Objective-C programmers, people like me who are new to Swift,

⏹️ ▶️ Marco tend to write Swift like Objective-C. And that’s a concern I’ve had, and it’s

⏹️ ▶️ Marco one of the reasons that I have procrastinated adopting Swift up till now, because

⏹️ ▶️ Marco I have a pretty good grasp on Objective-C now, and I write

⏹️ ▶️ Marco Objective-C code that I know is basically idiomatic and

⏹️ ▶️ Marco soundly designed. Like, I write code in the style of what I think Apple’s code would

⏹️ ▶️ Marco look like based on the little bit of, you know, headers and stuff that we see. I feel like I write good Objective-C code that is kind

⏹️ ▶️ Marco of correct and idiomatically sound. With Swift, you know, I assumed

⏹️ ▶️ Marco that the idioms would not yet be developed for a while and established for a

⏹️ ▶️ Marco while. And so I didn’t want to write a bunch of bad Swift code or

⏹️ ▶️ Marco like incorrect or weird Swift code, you know, investing heavily in it so early

⏹️ ▶️ Marco on. Do you think that it’s at a point now where the idioms are starting to get

⏹️ ▶️ Marco worked out enough that that’s less of a concern now?

⏹️ ▶️ Chris Latner Yeah, I do. So I think it’s definitely fair to say that in the Swift 1, the Swift 2 timeframes,

⏹️ ▶️ Chris Latner Swift as a language was changing really rapidly, and I could see why you’d feel like you’re on

⏹️ ▶️ Chris Latner uneven footing and not really sure what the language is, much less what the idioms are. Swift 3

⏹️ ▶️ Chris Latner really is quite well baked out, and so I expect that going forward the new things are going to be

⏹️ ▶️ Chris Latner additive. They’re not going to be changing the existing patterns. And so I think the Swift community

⏹️ ▶️ Chris Latner in general has gone through the same kind of thing that you’re feeling there where it’s not really

⏹️ ▶️ Chris Latner clear the one right way to solve the problem. And maybe there are different good

⏹️ ▶️ Chris Latner ways to do it with different trade-offs that weren’t clear to people. But I think people are starting to understand

⏹️ ▶️ Chris Latner that now. There are a few style books that are being written by people that I’ve heard about. And so

⏹️ ▶️ Chris Latner when those come out, those will hopefully be good and those will be a good resource.

⏹️ ▶️ Chris Latner But another thing to keep in mind is that Swift is opinionated,

⏹️ ▶️ Chris Latner I guess, is the

⏹️ ▶️ Chris Latner, Casey way to say it.

⏹️ ▶️ Chris Latner So it really does encourage you to do the right thing where it can. For example,

⏹️ ▶️ Chris Latner if you use var for everything, the Swift compiler will say, hey, you

⏹️ ▶️ Chris Latner mark this as a var, but it could be a let, and that’s just its subtle way of, and

⏹️ ▶️ Chris Latner let me fix it for you. And that’s just a subtle way of encouraging you to use immutable values,

⏹️ ▶️ Chris Latner which is a very small thing, but it’s just kind of pushing you in the way that

⏹️ ▶️ Chris Latner it thinks leads to better code. And immutability for a local variable doesn’t matter that much,

⏹️ ▶️ Chris Latner except that it communicates something more to the person who has to read and maintain your code. And

⏹️ ▶️ Chris Latner so I think that Swift really does kind of encourage you down the right lines in some ways. But

⏹️ ▶️ Chris Latner on the other hand, in other places where you’re saying, hey, should something be a class or should it be a struct, trade-offs are more nuanced

⏹️ ▶️ Chris Latner and it’s a harder thing and the Swift compiler can’t just know what problem it is that you want to solve and so it

⏹️ ▶️ Chris Latner can’t help you with that.

⏹️ ▶️ John So you mentioned Swift style guides before. As a creator of a language,

⏹️ ▶️ John how much influence do you feel like you want to have over things

⏹️ ▶️ John like style? Things that really are, you know, it’s not features, it’s not technical,

⏹️ ▶️ John it’s just like, like, uh, you know, we all know the different style things like, oh, you know, you should only

⏹️ ▶️ John have one exit at the bottom or you should exit early. Or I mean, like there are things you can do,

⏹️ ▶️ John uh, even things like spacing and brace style for crying out loud or, you know, or just the sort of idioms

⏹️ ▶️ John of like this little three line sequence is how you do this transformation on this data structure. Um,

⏹️ ▶️ John you mentioned, you know, language features can influence that. So obviously as language designer and participating in that process, you can

⏹️ ▶️ John effectively, uh, guide the community style-wise in one

⏹️ ▶️ John direction or another. But eventually you come to the stuff that’s just plain opinion and style.

⏹️ ▶️ John And several other languages have had fairly concrete styles

⏹️ ▶️ John set forth early on by the creators, you know, like K&RC style type things.

⏹️ ▶️ John How much do you care about being able to influence the, I guess the personal

⏹️ ▶️ John preference or the the aesthetic portions of style that are outside the things that

⏹️ ▶️ John you can influence as part of language design.

⏹️ ▶️ Chris Latner So as with any programmer that has a pulse, I have my preferred

⏹️ ▶️ Chris Latner style. And so clearly, that’s the right way. Naturally.

⏹️ ▶️ Chris Latner Naturally. Well, so I guess more seriously, the language itself does influence some of

⏹️ ▶️ Chris Latner the things you mentioned. So for example, it’s my personal opinion that the style

⏹️ ▶️ Chris Latner where you have a single entry and a single exit from every function, I think that leads to really difficult to maintain and read code.

⏹️ ▶️ Chris Latner And that’s one of the things that led to the guard statement existing. The guard really does encourage you

⏹️ ▶️ Chris Latner to use early exits so you handle the exceptional cases and then you don’t have to worry about them. So

⏹️ ▶️ Chris Latner that’s an example of where the language design is kind of encouraging you to, you

⏹️ ▶️ Chris Latner know, have multiple returns from a function. Other more subjective things like the number of spaces.

⏹️ ▶️ Chris Latner I personally am a fan of two-space indents. I know some people are staunchly four, other people are staunchly

⏹️ ▶️ Chris Latner eight. Some people think 80 columns is the right answer. I mean, all these things are, there are actually

⏹️ ▶️ Chris Latner really good arguments on all sides. Some people argue that you should use three-space indent because

⏹️ ▶️ Chris Latner then you certainly can’t have tabs in your file. Wow. So this is

⏹️ ▶️ Chris Latner where it comes down to you have to pick your battles, right? And

⏹️ ▶️ Chris Latner people will disagree for a long time and you can make

⏹️ ▶️ Chris Latner, Casey arguments on

⏹️ ▶️ Chris Latner both sides, but where we’ve come down is that it’s just more

⏹️ ▶️ Chris Latner practical to let people write code they like to look at, and that comes at a cost of if you switch between

⏹️ ▶️ Chris Latner teams or you pick up somebody else’s package, then maybe it’s indented the wrong way. But I

⏹️ ▶️ Chris Latner don’t think that really actually actively hurts the comprehensibility

⏹️ ▶️ Chris Latner of the code. That’s merely annoying. And having something like

⏹️ ▶️ Chris Latner GoFormat, which rigorously enforces the one true way, I think would have been nice. It just wasn’t

⏹️ ▶️ Chris Latner a priority early on, and it also just wasn’t a battle that we were willing to tackle. And

⏹️ ▶️ Chris Latner I don’t know, we’ll see. I think this is still also an open question in terms of what other tooling

⏹️ ▶️ Chris Latner gets built and what other things come into the fray, because it would be

⏹️ ▶️ Chris Latner great to have better tooling around this. It just hasn’t been built out yet, and it’s a great opportunity for open source as well.

⏹️ ▶️ John I was thinking about the sort of doomsday scenario where one of these Swift style guide books comes out

⏹️ ▶️ John and it makes some blanket recommendation that you should always

⏹️ ▶️ John use protocols for this and you should never use classes for that or whatever. And it becomes wildly popular

⏹️ ▶️ John and accepted as the Bible of how you write Swift programming and you’re just somewhere shaking your

⏹️ ▶️ John head and going, no, you got it all wrong. But I guess we’ll cross that bridge when we come to

⏹️ ▶️ John it. I mean, I think at this point, the language design itself and the community has had enough influence that that’s not likely

⏹️ ▶️ John to happen. But I mean, I guess what I was getting at is, do you feel like that you want to write a Swift-style guide? Like,

⏹️ ▶️ John if you had unlimited time?

⏹️ ▶️ Chris Latner No, I don’t think that would be a good use of my time.

⏹️ ▶️ Chris Latner, John But if I had unlimited time, maybe.

⏹️ ▶️ Chris Latner, Casey I don’t

⏹️ ▶️ Chris Latner know. It’s hard to answer that theoretical question. But also, to your concern

⏹️ ▶️ Chris Latner about somebody came out with a style book that was so wrong that would cause me to be

⏹️ ▶️ Chris Latner really unhappy, I actually have a ton of faith in the Swift community. Because if something came out that was so weird,

⏹️ ▶️ Chris Latner I don’t think that the community overall would accept it. The community

⏹️ ▶️ Chris Latner has, again, just kind of blown me away with how clueful they are and how

⏹️ ▶️ Chris Latner many great people have gotten involved with Swift and the Swift evolution side of things. And it’s been

⏹️ ▶️ Chris Latner really amazing to see these people, you know, they go through their own personal trajectory

⏹️ ▶️ Chris Latner on the Swift mailing list where, you know, initially they’re saying, hi, I had this idea, what do you

⏹️ ▶️ Chris Latner think? And the response is, no, that’s a terrible idea for this, this, this, this reason.

⏹️ ▶️ Chris Latner But then they come back and they’re like, hey, how about this? Do you ever think about this? And it was like, oh, well, that’s interesting. That almost

⏹️ ▶️ Chris Latner worked, but it didn’t work because of that. And then they come back and they say, hey, well, what about this? And we said, well, we actually

⏹️ ▶️ Chris Latner tried that, and we had that for a while, and then had to back out and change it this other way, because we didn’t even think about this other thing.

⏹️ ▶️ Chris Latner And then the next day, they’re the ones saying, this is the way it needs to go. And everybody says, you’re right.

⏹️ ▶️ Chris Latner We should do that. And it’s really hard for people that haven’t been involved

⏹️ ▶️ Chris Latner in the overall design of anything as complicated as Swift to be

⏹️ ▶️ Chris Latner able to discern the difference between something that is the way it is out of an intentional

⏹️ ▶️ Chris Latner decision process or the way it is as an accident of history.

⏹️ ▶️ Chris Latner And so as now that the design process is public, I think that it becomes a lot easier for people

⏹️ ▶️ Chris Latner to tell that and it’s very easy for people to kind of

⏹️ ▶️ Chris Latner understand that difference. The one big debate that I haven’t actually seen is why is the funk keyword

⏹️ ▶️ Chris Latner the funk keyword? And that’s one that luckily we’re now beyond the Swift 3

⏹️ ▶️ Chris Latner source compatibility threshold, so we just can’t have that discussion anymore. I think that would be great.

⏹️ ▶️ Chris Latner Darn.

⏹️ ▶️ John One of the best things of the Swift open source thing, the whole evolution process has is like

⏹️ ▶️ John the list of questions like the asked and answers questions like this is a commonly asked question and we’ve

⏹️ ▶️ John dealt with it before and you’re probably going to want to ask it too. So here’s here’s how it was asked before and here’s what the answer

⏹️ ▶️ John is. Not that everybody’s going to go and see that, but I love that that exists.

⏹️ ▶️ Chris Latner Well, and it’s also hilarious that that started out as the commonly proposed list and then at some point it became

⏹️ ▶️ Chris Latner the commonly rejected list. Yeah,

⏹️ ▶️ John right. Because if it’s commonly proposed, obviously it’s not getting through. And so you have to go to the rejected list.

⏹️ ▶️ John If you’re thinking about asking to change funk to FN you know.

Rust-style memory model?

⏹️ ▶️ John I know you talked about this before, but it is worth touching on again because many

⏹️ ▶️ John people have asked me to ask you this. A Swift and a

⏹️ ▶️ John Rust-style memory model, you phrased it before as an add-on feature

⏹️ ▶️ John for people who know that they need that type of thing, but that it would not, like that Swift

⏹️ ▶️ John wouldn’t become a language in which all memory is managed that way. Instead, this would be a special purpose feature

⏹️ ▶️ John for particular roles. roles do you think it’s suited

⏹️ ▶️ John for and why is it not the right memory model for all of Swift?

⏹️ ▶️ Chris Latner Well, so here’s the way I look at Swift in terms of memory management today. So Swift is using ARC,

⏹️ ▶️ Chris Latner it’s not using GC. If you want to talk about the tray out there, I’m happy to do that. That’s

⏹️ ▶️ Chris Latner its own rat hole we can fall into. ARC, I think, is overall an amazing

⏹️ ▶️ Chris Latner default for Swift because it gives you deterministic destruction, it gives you relatively

⏹️ ▶️ Chris Latner predictable performance, and the Arc Optimizer’s able to eliminate most

⏹️ ▶️ Chris Latner of the reference counting operations that happen. The problem that I see with Arc

⏹️ ▶️ Chris Latner as of today, or say Swift 3, is that it

⏹️ ▶️ Chris Latner is not a very controllable model. And so if, for example,

⏹️ ▶️ Chris Latner you have an inner loop and it turns out the Arc Optimizer’s doing a bunch of retains and releases, and

⏹️ ▶️ Chris Latner you know that they’re not necessary because you know the objects are alive, there’s nothing that

⏹️ ▶️ Chris Latner you can really do to solve that problem unless you’re willing to drop down to something like

⏹️ ▶️ Chris Latner the unsafe operations that Swift gives you for manipulating references to objects.

⏹️ ▶️ Chris Latner And so it’s really kind of dissatisfying to me to have a really safe, great memory model

⏹️ ▶️ Chris Latner that for performance reasons you have to drop down to unsafety. This is a huge cliff, and

⏹️ ▶️ Chris Latner it’s also a huge complexity cliff that you have to drop into to solve that problem.

⏹️ ▶️ Chris Latner And that’s not really great. So the promise, the dream, is to instead say,

⏹️ ▶️ Chris Latner hey, well, if you are a sufficiently advanced programmer and you know how this stuff works, well,

⏹️ ▶️ Chris Latner we can give you a new option. Instead of dropping down to unsafe constructs, you can actually just use more

⏹️ ▶️ Chris Latner static type information in annotations in your code. And so you

⏹️ ▶️ Chris Latner add a few annotations to say, hey compiler, this is OK. The compiler can then validate those type annotations

⏹️ ▶️ Chris Latner and check to make sure they’re correct. So it’s still memory safe. It’s still guaranteed to be OK. But you’re paying

⏹️ ▶️ Chris Latner for it in terms of more of this annotation in the code, and it’s more heavyweight

⏹️ ▶️ Chris Latner in terms of coding. But what you get out of that is the guarantee that no arc operations are happening.

⏹️ ▶️ Chris Latner Once you get to that model, then it becomes really interesting. Because you can say, hey, well, in this inner loop, I

⏹️ ▶️ Chris Latner found in my profiler that it really does matter for performance and the arc optimizer’s doing the wrong thing, well,

⏹️ ▶️ Chris Latner I can add a few local annotations and now the code is fast, it’s guaranteed to be fast, and

⏹️ ▶️ Chris Latner the clients of my code don’t have to know about it. This is an implementation detail. And I think this will really bring

⏹️ ▶️ Chris Latner us to the best of both worlds where you can have memory safety, you can have a

⏹️ ▶️ Chris Latner progressively disclosed complexity system where most people don’t have to know about it or think about it,

⏹️ ▶️ Chris Latner but you can get to really low level performance guarantees that otherwise aren’t possible. And

⏹️ ▶️ Chris Latner once we do this, I have a feeling there’ll be certain communities of people that will only want to work in this model.

⏹️ ▶️ Chris Latner And these are the communities that like Rust predominantly. So if you’re writing a kernel,

⏹️ ▶️ Chris Latner for example, maybe you don’t want to have a reference count in your object at all. And maybe you just want to

⏹️ ▶️ Chris Latner have, you know, you say I will always use these annotations in my code pervasively.

⏹️ ▶️ Chris Latner And if that happens, then there’s a couple of options that we can investigate. We could say, hey, well, if you mark

⏹️ ▶️ Chris Latner this class with some attribute then that prevents the compiler from ever doing

⏹️ ▶️ Chris Latner reference counting. And if it would ever do that, it just raises an error. Or we could even theoretically have

⏹️ ▶️ Chris Latner a language dialect mode that said, hey, produce an error anytime it did an arc operation.

⏹️ ▶️ Chris Latner I don’t like language dialects, and so we’d have to find a way to handle that. Maybe it would be a warning,

⏹️ ▶️ Chris Latner and then they would upgrade it to an error or something like that. But I can imagine doing something like that. And

⏹️ ▶️ Chris Latner once we do that, then I think you get to a really interesting mode where those systems

⏹️ ▶️ Chris Latner programming type people that otherwise would be using C or C++ can now use Swift.

⏹️ ▶️ Chris Latner And that means they only have to learn one language. That means that they get to use the same tool set,

⏹️ ▶️ Chris Latner that, you know, the ID and everything else that works great with Swift. It means

⏹️ ▶️ Chris Latner that they can scale and use the same language for different layers of their

⏹️ ▶️ Chris Latner stack because many applications have very low level pieces and very high level pieces. and having

⏹️ ▶️ Chris Latner them written in different languages is really kind of gross. I mean, I think we’ve seen this in the Objective-C

⏹️ ▶️ Chris Latner community where one of the best and most annoying things about Objective-C is that it has C in it,

⏹️ ▶️ Chris Latner right? And so this has been hugely important for Objective-C in practice, because if you run into a performance

⏹️ ▶️ Chris Latner problem with obviously message send, you can always rewrite that algorithm in C. And that’s really, really,

⏹️ ▶️ Chris Latner really important for Objective-C being successful and then both in the days of Next

⏹️ ▶️ Chris Latner on 16 MHz processors, but also today for the low-level code that people

⏹️ ▶️ Chris Latner are writing. But it also means that that’s one of the problems that makes it so that Objective-C and

⏹️ ▶️ Chris Latner C are so tightly intertwined. And so you can’t actually take the C part out of Objective-C without producing

⏹️ ▶️ Chris Latner a different language.

Swift in the browser

⏹️ ▶️ John Or waiting for Swift in the web browser, because it’s your only escape. So we can have applications that have to have one language

⏹️ ▶️ John at the

⏹️ ▶️ John, Chris Latner higher level and a different language at the lower one. That’s a tough one.

⏹️ ▶️ Chris Latner Well, that I think is a frontier that is probably the biggest payoff,

⏹️ ▶️ Chris Latner because replacing JavaScript would be such an amazing service to the world.

⏹️ ▶️ Chris Latner You just mentioned Dart before. It’s been tried. Yeah, but

⏹️ ▶️ Chris Latner it’s been tried. And that’s where I’m putting my hope on the Asm.js, the WebAssembly,

⏹️ ▶️ Chris Latner those kinds of efforts where it’s enabling languages like Swift and

⏹️ ▶️ Chris Latner Swift compiles through LLVM, WebAssembly and Asm.js both have LLVM backends

⏹️ ▶️ Chris Latner and principles, so they could wire up Swift to one of those and go to town with it.

⏹️ ▶️ Chris Latner If those end up winning and they become big, big things, then

⏹️ ▶️ Chris Latner maybe that’ll be good enough. But I don’t really know. I don’t have… My crystal ball doesn’t go out to the point

⏹️ ▶️ Chris Latner where JavaScript is not in web browsers.

⏹️ ▶️ John Yeah, that’s the difficult part It’s not that not the language mechanics. It’s the getting Getting something we can

⏹️ ▶️ John understand that in front of as many people as possible.

⏹️ ▶️ Chris Latner It’s also very interesting to me So and again, I’m not a web developer and I’m not a I’m definitely not an

⏹️ ▶️ Chris Latner expert in the space but to me it seems that the trajectory of JavaScript has

⏹️ ▶️ Chris Latner Basically made it into an intermediate language It’s not something that developers are writing as much

⏹️ ▶️ Chris Latner directly as they used to. And so I see TypeScript and a lot of other languages that now compile down to JavaScript

⏹️ ▶️ Chris Latner and they’re really using JavaScript like a bit code representation, not

⏹️ ▶️ Chris Latner a source language that people are thinking about as much anymore. And so I wonder if in five years,

⏹️ ▶️ Chris Latner the natural conclusion of that is that JavaScript is just an Asm.js type of thing, or maybe

⏹️ ▶️ Chris Latner WebAssembly does take over. But again, I’m not the expert. I don’t know where that

⏹️ ▶️ Chris Latner direction will go. I know that some people love JavaScript. So we’ll see.

⏹️ ▶️ John On the topic of using languages other than JavaScript to write JavaScript, I have to say,

⏹️ ▶️ John having done that several times, that the tooling, boy, the tooling is not quite where you’d

⏹️ ▶️ John want it to be in terms of being able to write and debug and profile

⏹️ ▶️ John in the preferred language and not in the compiled down to JavaScript type language.

⏹️ ▶️ John But yeah, maybe that’ll be like stage 17 in the Swift world domination plan.

⏹️ ▶️ John, Chris Latner Keep on the

⏹️ ▶️ Chris Latner agenda. And I think that’s always been true for pre-processors. So, I mean, even in C, if you do crazy things with

⏹️ ▶️ Chris Latner the macro pre-processor in C, you get debugging those things are so horrible.

⏹️ ▶️ Chris Latner And that’s one of the reasons that we’ve been careful about not adding a macro system to Swift early.

⏹️ ▶️ Chris Latner It just brings lots of interesting trade-offs in terms of the debugging, developing, designing experience.

ABI stability

⏹️ ▶️ John So one last thing on ABI compatibility. According to the timelines

⏹️ ▶️ John that I’ve heard sketched out, ABI stability could be

⏹️ ▶️ John a thing before async, you know, or concurrency stuff lands

⏹️ ▶️ John in Swift. Is there any dependencies or chicken-egg things involved

⏹️ ▶️ John in there? Like, in other words, in order to… Do you have to nail down some aspects

⏹️ ▶️ John of your concurrency model before you can commit to ABI stability, or are they totally orthogonal?

⏹️ ▶️ Chris Latner I think they’re totally orthogonal. I think the memory ownership model has more of an impact on ABI

⏹️ ▶️ Chris Latner stability, because there’s some very low-level things, like how the

⏹️ ▶️ Chris Latner getters and setters are co-generated for a property, for example, that end up getting

⏹️ ▶️ Chris Latner impacted by the ownership model. That’s one of the reasons that the

⏹️ ▶️ Chris Latner Swift team is actually actively designing and working on a proposal for

⏹️ ▶️ Chris Latner the memory ownership stuff right now. It’s not so that it can be a Swift 4 feature, it’s so

⏹️ ▶️ Chris Latner that the ABI stability work can be done in light of the ultimate model for the

⏹️ ▶️ Chris Latner memory ownership support. And I think concurrency is not

⏹️ ▶️ Chris Latner going to be something that impacts ABI stability at all. But we’ll see, and if so,

⏹️ ▶️ Chris Latner then the sufficiently smart programmers that work on Swift will figure it out, and I’m sure it

⏹️ ▶️ Chris Latner will be great. I think it’s also an interesting question of whether ABI stability will be

⏹️ ▶️ Chris Latner done for Swift 4 because it’s a huge amount of work.

⏹️ ▶️ Chris Latner The work is well underway, of course, but it’s also not clear to me that’s really

⏹️ ▶️ Chris Latner the right, or the most important thing for the Swift community. And one of the things that Ted

⏹️ ▶️ Chris Latner has been a huge champion for and I think he’s right about is that the most important thing right

⏹️ ▶️ Chris Latner now for the Swift community is making the compiler more reliable, making the error messages better,

⏹️ ▶️ Chris Latner making compile times faster and making it scale better to

⏹️ ▶️ Chris Latner large projects. And we’ll see how the rest of the Swift 4 schedule goes,

⏹️ ▶️ Chris Latner but I wouldn’t be surprised if at some point they decide that focusing on that on that is more important

⏹️ ▶️ Chris Latner than nailing ABI stability in Swift 4.

Leaving it in good hands

⏹️ ▶️ Marco So you just mentioned Ted, that’s Ted Kremenek, who is now the lead of the Swift project,

⏹️ ▶️ Marco is that right?

⏹️ ▶️ Chris Latner, Marco Yeah,

⏹️ ▶️ Chris Latner he’s the project lead. So Ted has been managing the Swift and Clang

⏹️ ▶️ Chris Latner projects before that for a number of years. He’s been at Apple for 10 years now. He’s a

⏹️ ▶️ Chris Latner Stanford PhD graduate. He built single, almost single-handedly,

⏹️ ▶️ Chris Latner the first Clang stack analyzer. Yeah, that’s Ted.

⏹️ ▶️ Marco So as a, I love that I’m saying this now, as a Swift developer, should

⏹️ ▶️ Marco I be… As we saw when you announced that you were leaving Apple, we saw

⏹️ ▶️ Marco some of the people in the community asking like, should we be worried about Swift’s future? Is Swift in good hands now? I mean,

⏹️ ▶️ Marco it seems like most of us didn’t know Ted, or at least didn’t know his name or weren’t familiar with his contributions.

⏹️ ▶️ Marco It does seem like he’s been doing quite a bit there anyway. Should we be worried?

⏹️ ▶️ Chris Latner I don’t think you should be worried at all. I think Swift is in amazing hands as is, I mean,

⏹️ ▶️ Chris Latner all the things that I am leaving behind at Apple in quotes are in really good hands. And that’s

⏹️ ▶️ Chris Latner one of the only reason I was comfortable in moving on. In the case of Ted,

⏹️ ▶️ Chris Latner Ted is a rock star. He has been running the Swift team and managing them for,

⏹️ ▶️ Chris Latner I mean, four or five years now. The roles

⏹️ ▶️ Chris Latner that we had was that Ted owned and ran his team and then reported to me. And so

⏹️ ▶️ Chris Latner I would mess around and cause trouble by trying to get people

⏹️ ▶️ Chris Latner to do the exciting, important thing that I thought and maybe it didn’t align with the

⏹️ ▶️ Chris Latner actually important thing. And therefore, I’d introduce chaos into the world.

⏹️ ▶️ Chris Latner But Ted was always the stable rudder and the one that was really focused on getting the important things done.

⏹️ ▶️ Chris Latner He has a number of really exceptional engineers on the team, people on the core team like Doug Greger, John McCall,

⏹️ ▶️ Chris Latner Joe Groff, Dave Abrahams. These are all just amazingly brilliant people. And

⏹️ ▶️ Chris Latner also the team includes a bunch of other engineers that are equally dedicated and also

⏹️ ▶️ Chris Latner just totally amazing people to work with. So the SWIFT team is, I think, one of Apple’s biggest

⏹️ ▶️ Chris Latner assets. It’s crazy how brilliant and dedicated they are to the project and

⏹️ ▶️ Chris Latner how excited they are to get to world domination one step at a time.

The shoemaker’s language

⏹️ ▶️ Casey Coming back to kind of a more broad thing, let’s say that, and this is not meant to

⏹️ ▶️ Casey be a tongue-in-cheek reference to your next job. This is just in general. You’re at home, your

⏹️ ▶️ Casey kids are in bed, your wife is out or something like that, and you wanna just write some code. You can’t

⏹️ ▶️ Casey use Swift and you can’t use Objective-C. What are you writing code in? And I know that’s often dependent on

⏹️ ▶️ Casey what project you’re accomplishing, but what’s interesting to you these days that isn’t Swift and isn’t Objective-C?

⏹️ ▶️ Chris Latner Oh, well, so I mean, I have a ton of different interests. I mean, I really love building ray tracers, for example,

⏹️ ▶️ Chris Latner and I’ve done a bunch of stuff with that. And I guess if I couldn’t use Swift for that,

⏹️ ▶️ Chris Latner then I would probably have to use C++.

⏹️ ▶️ Chris Latner, John Oh,

⏹️ ▶️ John I was going

⏹️ ▶️ John, Marco to call

⏹️ ▶️ John, Chris Latner that,

⏹️ ▶️ John, Marco but I

⏹️ ▶️ John wanted to give you a chance to not

⏹️ ▶️ John, Marco say C++. This is

⏹️ ▶️ John, Casey what

⏹️ ▶️ John I remind people when they

⏹️ ▶️ John, Casey mention it.

⏹️ ▶️ John You know what LLVM is written in, right?

⏹️ ▶️ John, Casey You can’t

⏹️ ▶️ John, Chris Latner write that much

⏹️ ▶️ John C++ and not have your answer be C++.

⏹️ ▶️ Chris Latner And do you know how much angst and personal suffering it causes to have to be writing C++ all day

⏹️ ▶️ Chris Latner and building a beautiful world for other people? It’s just so unfair. Yeah.

⏹️ ▶️ John That’s where you toil, down in the

⏹️ ▶️ Chris Latner mines. Yeah, yeah. It’s pain and suffering that’s worth it for the bigger victory. Well,

⏹️ ▶️ John that’s where Swift comes from. Years having to use C++. I could do the same stuff but not feel this much pain.

⏹️ ▶️ John That’s

⏹️ ▶️ Chris Latner exactly right. There’s a lot of suffering that led to Swift needing to happen

⏹️ ▶️ Chris Latner So but but it also it really depends I mean, maybe if I was doing you know, if I was a crazy person I’d use pearl for something

⏹️ ▶️ Chris Latner I don’t know if I’m that insane

⏹️ ▶️ Casey Well

⏹️ ▶️ Casey, Chris Latner done

⏹️ ▶️ Casey well done you never go to read it though nobody could

⏹️ ▶️ Chris Latner hey if it’s throwaway code then you never need to read it

⏹️ ▶️ Chris Latner, Marco Poor John

⏹️ ▶️ Chris Latner I’ll

⏹️ ▶️ John just wait for my Pearl Six Grammars to land gently in Swift.

⏹️ ▶️ John, Chris Latner Yeah,

⏹️ ▶️ Chris Latner I mean, that’s a great example of Pearl really has nailed the string processing

⏹️ ▶️ Chris Latner thing, even in Pearl Five, and I think Pearl Six is even better. And Swift has a lot to learn from

⏹️ ▶️ Chris Latner it, and that’s something where Swift 4 is really

⏹️ ▶️ Chris Latner learning from Pearl. So I think that’s great.

⏹️ ▶️ Casey Please don’t give him any ammunition. This is terrible. I was enjoying this interview so much until this very moment.

⏹️ ▶️ Chris Latner Look at it this way, once this happens, John will have no excuse.

⏹️ ▶️ Marco Oh, he will find one.

⏹️ ▶️ Casey Nothing is so perfect that it can’t be complained about. Oh my goodness.

Dynamic features

⏹️ ▶️ John This is a perennial topic on the Swift mailing list. It’s about

⏹️ ▶️ John dynamic features in Swift.

⏹️ ▶️ John, Casey Things that

⏹️ ▶️ John are, quote unquote, more dynamic in Objective-C and less so in Swift.

⏹️ ▶️ John In the Swift community, there’s a lot of angst about when, if ever, will Swift allow

⏹️ ▶️ John me to, essentially, like what you said before, you can write Fortran in any language, you can write Objective-C

⏹️ ▶️ John in any language. People will try to write their code in Swift, but using

⏹️ ▶️ John models from Objective-C that require things like, you

⏹️ ▶️ John know, sending messages to objects that you know will receive them, but the compiler can’t guarantee, or, you know, having

⏹️ ▶️ John big heterogeneous collections where you’re just like, no, everything’s ID and it’ll be fine.

⏹️ ▶️ John I don’t even know how to frame this, but I think that the main question has been,

⏹️ ▶️ John are dynamic features possible in Swift? And are they coming in Swift? Or is there

⏹️ ▶️ John some kind of philosophical divide where the most dynamic stuff that people really want

⏹️ ▶️ John will never be forthcoming, not for technical reasons, but just for philosophical and safety reasons?

⏹️ ▶️ Chris Latner Sure. So I’ve been pretty outspoken about this on the Swift Evolution list, so hopefully this isn’t a huge surprise. But

⏹️ ▶️ Chris Latner I don’t think there’s any tension between dynamic features and Swift.

⏹️ ▶️ Chris Latner A lot of people wanna make hay and argue about how it would be impossible to do

⏹️ ▶️ Chris Latner responders or pick your feature in Swift.

⏹️ ▶️ Chris Latner And the worst case scenario, frantic blog posts I’ve seen are things

⏹️ ▶️ Chris Latner that are along lines of someday Apple will rewrite all of its frameworks in Swift

⏹️ ▶️ Chris Latner and then it will be impossible to write responder chains and then bad things will happen and

⏹️ ▶️ Chris Latner then we’ll be back in the days of MSC or some other bad thing, right?

⏹️ ▶️ Chris Latner, Casey Oh God, don’t even bring

⏹️ ▶️ Casey, Chris Latner that up.

⏹️ ▶️ Chris Latner Exactly. And so this is this is kind of quite the slope that it’s the discussion ends up being.

⏹️ ▶️ Chris Latner I think this blew up most recently right before WWDC this year. And

⏹️ ▶️ Chris Latner it was really interesting to watch the blog posts that people are flinging around because

⏹️ ▶️ Chris Latner everybody had a different idea of what dynamic meant.

⏹️ ▶️ Chris Latner, Casey None of

⏹️ ▶️ Chris Latner them really. So Apple is not going to counter or blog

⏹️ ▶️ Chris Latner somebody and denounce a blog on somebody’s post.

⏹️ ▶️ Chris Latner And it’s kind of bad form to do that. But I thought it was very interesting and odd that none of those people actually came to the

⏹️ ▶️ Chris Latner Swift evolution list, which is the right place to do that, and asked about it. They all just wanted to make these

⏹️ ▶️ Chris Latner inflamed blog posts for various kinds. So if you get to my opinion, my opinion is that

⏹️ ▶️ Chris Latner none of those are in tension with Swift’s current design. It’s just a matter of prioritization.

⏹️ ▶️ Chris Latner And the major problem that Swift has is, again, there’s so much work to

⏹️ ▶️ Chris Latner do. There’s concurrency model, there’s actors, there’s systems programming, there’s scripting,

⏹️ ▶️ Chris Latner there’s lots of little things that go in. There’s better things to support static

⏹️ ▶️ Chris Latner analysis, introducing type state into language. There’s pre and post conditions.

⏹️ ▶️ Chris Latner There’s so many things that will be bricks in the house of Swift

⏹️ ▶️ Chris Latner that we want to build that need to happen, that it doesn’t really make sense

⏹️ ▶️ Chris Latner to spend a lot of time building dynamic features so that Apple could theoretically someday

⏹️ ▶️ Chris Latner do something. Right? The Swift team is much more focused on the practical necessities of solving

⏹️ ▶️ Chris Latner the real world problems here and now in front of people. And dynamic features,

⏹️ ▶️ Chris Latner like many other things, will just kind of flop in place when the team has time to design

⏹️ ▶️ Chris Latner and roll them out. And so you will be able to someday, or I expect

⏹️ ▶️ Chris Latner that you will be able to reflect over all the methods that a class has, for example.

⏹️ ▶️ Chris Latner Today, even, the Swift compiler’s generating all the metadata so you can reflect over all the

⏹️ ▶️ Chris Latner data members and your values. We just don’t have an API wrapped around that. But that metadata

⏹️ ▶️ Chris Latner is what the Xcode memory heap viewer uses, for example. And so

⏹️ ▶️ Chris Latner there’s a lot of that kind of stuff being put in place, but just hasn’t had time to fully bake out yet.

⏹️ ▶️ Chris Latner And when it does come in, I think it’s gonna really exciting and will open more doors for new kinds of patterns

⏹️ ▶️ Chris Latner that people can do and a lot of those will be familiar to Objective-C programmers, but they’ll also be super useful for

⏹️ ▶️ Chris Latner things that people really haven’t done in Objective-C. So I don’t see a lot of tension

⏹️ ▶️ Chris Latner there though. It’s just a prioritization question.

⏹️ ▶️ John I think where people are coming from is that in terms of prioritization, because if you’re used to doing things

⏹️ ▶️ John with certain sort of design patterns, broadly speaking, in Objective-C and you want to come and implement

⏹️ ▶️ John those same patterns in Swift and you find that you can’t because you’re lacking some feature, it

⏹️ ▶️ John feels like there’s a barrier up. And that’s getting back to writing your Swift in Objective-C style.

⏹️ ▶️ John And that’s more of a barrier. They retreat back to Objective-C because I can write it the way I wanted to write it, and it works in Objective-C.

⏹️ ▶️ John When I try to write it that way and Swift doesn’t work for me, your choice is to change the way you write it to be better fit for

⏹️ ▶️ John what Swift has or to go back to Objective-C. So…

⏹️ ▶️ Chris Latner I don’t agree with that, though, because is Swift does support all the features

⏹️ ▶️ Chris Latner for dynamic dispatch and method lookup and everything else that Objective-C does. It just requires

⏹️ ▶️ Chris Latner you to use the Objective-C subset of the language because it exposes it through the runtime.

⏹️ ▶️ John Right, that’s the tension because they’re like, oh, I want to write it in pure Swift, like

⏹️ ▶️ John as if there’s something special and magical about not using Objective-C runtime, you

⏹️ ▶️ John know what I mean? You do get a medal for that.

⏹️ ▶️ Chris Latner, John Yeah.

⏹️ ▶️ Chris Latner I guess it makes some people feel good. I mean, there are, I can’t really

⏹️ ▶️ Chris Latner counter that, but I just don’t think that it’s actually fair to say you have to fall back to writing

⏹️ ▶️ Chris Latner Objective-C

⏹️ ▶️ Chris Latner, John code. Yeah,

⏹️ ▶️ John no, no, I’m just, I’m

⏹️ ▶️ John, Chris Latner trying

⏹️ ▶️ John to, I didn’t write one of these blog posts, so to be fair, I’m trying to express what I saw in there, because that was a lot of the concern

⏹️ ▶️ John was like, they wanna do it, they wanna do it like the new way and the right way, and

⏹️ ▶️ John part of doing that is not, you know, at Objective-Cing everything, and be like, oh, that feels like a compromise in the old way, so

⏹️ ▶️ John they are setting their own goalposts for themselves arbitrarily to try to enter

⏹️ ▶️ John into this new world. And they want to jump in with both feet or not

⏹️ ▶️ John at all. And some of them might end up bailing. But I think this,

⏹️ ▶️ Chris Latner I mean, the way I look at that is, I look at that as an area where the language is not fully

⏹️ ▶️ Chris Latner baked out. It’s not fully serving their needs. And I think that’s really unfortunate.

⏹️ ▶️ Chris Latner And I’m not going to say that I think that’s not a good thing. I want there to be an awesome reflection model.

⏹️ ▶️ Chris Latner I don’t want there to be awesome features for sending messages like they’re used to. I just want

⏹️ ▶️ Chris Latner it to be developed and designed in the right way. And at the same time, they’re being annoyed

⏹️ ▶️ Chris Latner that they can’t do those things. There are a lot of other people being annoyed about compile times, right?

⏹️ ▶️ Chris Latner, Marco Yeah, I know.

⏹️ ▶️ Chris Latner And what we have to do is balance between, you know, just picking

⏹️ ▶️ Chris Latner two random things. Where does the engineering effort go? And

⏹️ ▶️ Chris Latner that’s never a black and white thing. There’s never a right answer. It’s all based on gut and judgment

⏹️ ▶️ Chris Latner and guesses, listening to the community, talking to people. And that’s one of the reasons why

⏹️ ▶️ Chris Latner I think the Swift team is really phenomenal is that it really cares. It really cares about what people

⏹️ ▶️ Chris Latner are doing. It reads, you know, the various people read the blog posts, there are people on Twitter, that like

⏹️ ▶️ Chris Latner the engagement between the Swift team and the community is really high because people care.

⏹️ ▶️ Chris Latner And there’s no management dictated apple that says that, you know, this engineer should be on Twitter all the

⏹️ ▶️ Chris Latner time talking to people, that’s certainly not the case. That’s because of passion from the developer and it’s because

⏹️ ▶️ Chris Latner they really care. And I think that’s the thing that is so amazing about the Swift team is

⏹️ ▶️ Chris Latner just how important it is in terms of customer service and understanding

⏹️ ▶️ Chris Latner what people are working through. And that insight is what guides the priority

⏹️ ▶️ Chris Latner decisions and guides the trade-offs that have to be made all the time because nothing really is

⏹️ ▶️ Chris Latner as clear as you’d like it to be.

Community influence

⏹️ ▶️ Casey So building on that, when all of us were going back and forth, and I was tangentially

⏹️ ▶️ Casey involved with this, we were going back and forth about, oh, Swift isn’t dynamic, it must be dynamic.

⏹️ ▶️ Casey Is it fair to say that that does eventually make its way inside of Apple? And just

⏹️ ▶️ Casey that you guys are aware of it, that that’s talked about in some way, shape, or form? Because

⏹️ ▶️ Casey it’s nice to know, and I suspect that it does, but it’s nice to know that when the community gets

⏹️ ▶️ Casey perturbed, whether or not that feeling is justified, that at least somebody

⏹️ ▶️ Casey inside Apple has heard it. Whether or not they can respond to it, at least they’ve heard it. So when we

⏹️ ▶️ Casey all get our pants all twisted up, does that make

⏹️ ▶️ Casey it in?

⏹️ ▶️ Chris Latner Jay Haynes Absolutely. I mean, there are a ton of people at Apple that care about

⏹️ ▶️ Chris Latner what’s happening in the developer community and elsewhere, right? And that’s one of the

⏹️ ▶️ Chris Latner things about Apple’s approach in terms of not commenting on things that can be frustrating because you don’t know.

⏹️ ▶️ Chris Latner But again, there’s so many people at Apple that really do care and that saw

⏹️ ▶️ Chris Latner it. And again, I wish those people that were

⏹️ ▶️ Chris Latner really worried about it would come to Swift Evolution and ask because then we could have a discussion about it, but that

⏹️ ▶️ Chris Latner wasn’t happening for some reason. But certainly there was a ton of people that saw the blogs. And

⏹️ ▶️ Chris Latner I’m sure there are tons of engineers at Apple that feel the same way and wish the priorities were different And

⏹️ ▶️ Chris Latner I think that the engineering community inside of Apple reflects quite closely to the engineering

⏹️ ▶️ Chris Latner community outside of Apple as well. And I don’t think that that’s, I hope that’s

⏹️ ▶️ Chris Latner not surprising,

⏹️ ▶️ Chris Latner, John right?

⏹️ ▶️ Chris Latner Apple has many different engineers with different feelings and different opinions. And I think that’s a

⏹️ ▶️ Chris Latner really good thing. If it were a super monoculture or something like that, that would probably be very unhealthy.

RxSwift

⏹️ ▶️ Casey Taking a little bit of a turn, so I started writing Swift almost

⏹️ ▶️ Casey exactly a year ago now, and the project that I’m doing at work, we’re using RxSwift

⏹️ ▶️ Casey and quote-unquote reactive programming. And I’m curious, have you looked into that at all?

⏹️ ▶️ Casey And do you have any particular thoughts on it? Does it seem barbaric to you? Does it seem clever? Does it just seem like

⏹️ ▶️ Casey an odd choice? What is your take on this whole Rx thing?

⏹️ ▶️ Chris Latner Yeah, so I’ve definitely seen it. I have no real world usage experience.

⏹️ ▶️ Chris Latner So most of my opinion is based on reading blogs and reading people talking about how awesome

⏹️ ▶️ Chris Latner it is while not

⏹️ ▶️ Chris Latner, John talking about

⏹️ ▶️ Chris Latner the problems. From what I gather, it seems like

⏹️ ▶️ Chris Latner it is a way of letting you write a lot less code and code that often works

⏹️ ▶️ Chris Latner better the first time. And I can see how that’s super appealing. It also seems like it’d be really challenging to debug it and

⏹️ ▶️ Chris Latner maintain it. And so I don’t know between the two, between the pros and cons, how it balances

⏹️ ▶️ Chris Latner out. If I were writing a lot of high-level apps, I would probably try it out on an app

⏹️ ▶️ Chris Latner or two and see if I liked it, but aside from that, I don’t really

⏹️ ▶️ Chris Latner have a good insight either way if it’s the right thing to do or not.

⏹️ ▶️ Casey Sure, sure, absolutely. You mentioned a second ago that you see some problems and you mentioned debugging.

⏹️ ▶️ Casey Is there anything else that jumps out at you as being a big concern, or is it just that it’s so different?

⏹️ ▶️ Chris Latner I mean, I’m not afraid of different things. I think that it’s more of, I mean, the

⏹️ ▶️ Chris Latner questions I’d raise, and this is out of ignorance, not out of fear, but what is

⏹️ ▶️ Chris Latner the community doing? Is there a support line?

⏹️ ▶️ Chris Latner Is it changing and evolving in a way that is good or bad? And these are just things I don’t know because

⏹️ ▶️ Chris Latner I haven’t used it. But I have nothing against the Rx community at all, and I’ve seen a lot of really cool things

⏹️ ▶️ Chris Latner they’ve done, and I’ve read many of the positive posts in Rx and

⏹️ ▶️ Chris Latner React Native and many of the other things where people are using Reactive techniques. And Reactive Cocoa

⏹️ ▶️ Chris Latner has also been around for quite a while. And I think that’s a really interesting application that

⏹️ ▶️ Chris Latner maybe became a lot easier when Swift came out than doing it in Objective-C. Yeah,

⏹️ ▶️ Casey absolutely.

⏹️ ▶️ Chris Latner So I think that it’s great that Swift can support different kinds of programming models like that because

⏹️ ▶️ Chris Latner if a awesome new right answer to some problem comes out, you’d hope

⏹️ ▶️ Chris Latner that your system can support it and can make it really elegant and beautiful.

GC vs. ARC

⏹️ ▶️ John I feel kind of like this is fighting, you know, the last war instead of the current

⏹️ ▶️ John war, but you mentioned garbage collection versus ARK a bunch of times, and obviously that ship

⏹️ ▶️ John has sailed, but I would love for you to give a

⏹️ ▶️ John reasonable summary of what the trade-offs were there, because Objective-C had garbage collection,

⏹️ ▶️ John as you mentioned.

⏹️ ▶️ John, Casey Well, sort of. Yeah, well, you know, it was there.

⏹️ ▶️ John And eventually Objective-C dropped the garbage collection and got ARC, and of course, Swift doesn’t have garbage

⏹️ ▶️ John collection at all. Can you talk about the tradeoffs there and why Swift is the way it is?

⏹️ ▶️ Chris Latner Well, would you like a comparison of ARC against the garbage collection Objective-C

⏹️ ▶️ Chris Latner had or garbage collection in theory?

⏹️ ▶️ John You could pick garbage collection in a language perhaps not as burdened as Objective-C with C backwards

⏹️ ▶️ John compatibility. But, you know, that’s worth mentioning as well, I think. I think

⏹️ ▶️ Chris Latner that, so Objective-C had a system based on Libato, Libato had a bunch of implementation concerns and

⏹️ ▶️ Chris Latner other things that I think don’t reflect, that don’t obviously reflect onto

⏹️ ▶️ Chris Latner the ultimate garbage collector that you’d ever wanna have. And so I don’t think the comparing against that

⏹️ ▶️ Chris Latner is interesting. But let me turn around. So why do you think garbage collection’s interesting? What is compelling

⏹️ ▶️ Chris Latner about garbage collection beyond ARC?

⏹️ ▶️ John Well, the idea that memory management is completely out of the hands of the programmer and

⏹️ ▶️ John that some magical fairy behind the scenes will make it all good for you. And

⏹️ ▶️ John obviously, what you’re giving up is what you mentioned before, that even with ARC, you lack some amount of control

⏹️ ▶️ John that you’ll need to have a language that becomes a system programming language. Obviously, you give that up with garbage collection because you’re not going

⏹️ ▶️ John to be doing a system programming language with a garbage collector behind it. Although,

⏹️ ▶️ John I think Microsoft has some projects to do that, that Singularity project, where they were trying to build a whole OS off of garbage collection.

⏹️ ▶️ John I’m not quite sure how that’s going.

⏹️ ▶️ Chris Latner Right, but even if you ignore the systems programming side of things, because I think it’s fair to say a lot of

⏹️ ▶️ Chris Latner people don’t care about that. So garbage collection is proven

⏹️ ▶️ Chris Latner in the application space for Java, for example, right? And Perl.

⏹️ ▶️ Chris Latner But do-

⏹️ ▶️ Chris Latner, John Perl uses

⏹️ ▶️ John reference counting, come on.

⏹️ ▶️ Chris Latner Oh, that’s right. It’s Python that uses reference counting plus cycle collector. So, but

⏹️ ▶️ Chris Latner let me ask you again. So you said it means you don’t have to think about memory. Is that true?

⏹️ ▶️ John Well, that’s the pitch. The pitch is that the programmer doesn’t have to think about it. They have to think about it when the garbage

⏹️ ▶️ John, Chris Latner collector starts.

⏹️ ▶️ John I understand the pitch. But is it true? When the garbage collector starts doing things you don’t want, then all of

⏹️ ▶️ John a sudden you do have to think about it. But then there’s almost nothing you can do about it. Yeah.

⏹️ ▶️ Chris Latner So here’s the way I look at it. And as you said, the ship has somewhat sailed.

⏹️ ▶️ Chris Latner I am totally convinced the Ark is the right way to go up front. It is better

⏹️ ▶️ Chris Latner in a whole bunch of different ways. It gives you deterministic behavior. So you don’t get,

⏹️ ▶️ Chris Latner you know, it doesn’t have the unpredictable stutter problem that people like to bash on GCs.

⏹️ ▶️ Chris Latner The stutter problem to me isn’t really the issue, even though that’s what GC haters

⏹️ ▶️ Chris Latner will bring up all the time. It’s more about being able to reason about when the memory goes away.

⏹️ ▶️ Chris Latner And the most important aspect of that is that ARC gets rid of finalizers. So if

⏹️ ▶️ Chris Latner you use a garbage collected language, you use finalizers. Finalizers are the thing that gets run when your

⏹️ ▶️ Chris Latner object gets destroyed. Finalizers have so many problems, there’s

⏹️ ▶️ Chris Latner entire bodies of work talking about how to work around problems with finalizers. For example, the finalizer gets run

⏹️ ▶️ Chris Latner on the wrong thread, it has to get run multiple times, the object can get resurrected while the finalizer’s running.

⏹️ ▶️ Chris Latner It happens non-deterministically later, you can’t count on it, and so you can’t use it for resource management

⏹️ ▶️ Chris Latner for database handles and things like that, for example. There are so many problems

⏹️ ▶️ Chris Latner with finalizers that ARC just defines away by having deterministic destruction.

⏹️ ▶️ Chris Latner Beyond that, ARC, so the common,

⏹️ ▶️ Chris Latner another common thing, there are two arguments that people make against ARC in

⏹️ ▶️ Chris Latner favor of a trace and garbage collector. One of which is that ARC adds overhead because you have

⏹️ ▶️ Chris Latner retainer release operations that run, and that is true. The other is that

⏹️ ▶️ Chris Latner you have to think about cycles in ARC. because it

⏹️ ▶️ Chris Latner doesn’t automatically collect cycles. And that is also true. And the rebuttal I’d

⏹️ ▶️ Chris Latner give to people is that those problems are also true in garbage collection,

⏹️ ▶️ Chris Latner just in different ways. So in a garbage collector, for example, people don’t think about it, but

⏹️ ▶️ Chris Latner garbage collection injects additional code into your application, just like Arc does. And so,

⏹️ ▶️ Chris Latner you know, there are many different garbage collection algorithms. Not all of them are the same, But

⏹️ ▶️ Chris Latner the most modern garbage collectors that use a nursery for

⏹️ ▶️ Chris Latner short lifetime objects and then promote them out that are generational use something called a write

⏹️ ▶️ Chris Latner barrier. And a write barrier is every time you store to a

⏹️ ▶️ Chris Latner property of an object, say, you have to run additional code. Garbage collectors also

⏹️ ▶️ Chris Latner need the ability to stop all the threads, or at least to be able to stop threads at some point in time. and

⏹️ ▶️ Chris Latner they need to be able to do so within a specific time bound because they don’t want the garbage collector to take forever.

⏹️ ▶️ Chris Latner The artifact of that is that typical garbage collectors in Java, for example, will

⏹️ ▶️ Chris Latner introduce what’s called a safe point into loops. And so now in your loops, extra

⏹️ ▶️ Chris Latner code is being run because of the garbage collector. And on more aggressive garbage

⏹️ ▶️ Chris Latner collection algorithms, for example, I was reading a blog post recently about Go’s tricolor

⏹️ ▶️ Chris Latner algorithm. They’re touting the advantage of, you get really low latency,

⏹️ ▶️ Chris Latner and you get the ability to guarantee response times in a more

⏹️ ▶️ Chris Latner fine-grained level than most garbage collectors. But to do that, they use this tricolor algorithm, which

⏹️ ▶️ Chris Latner dramatically lowers throughput. And it dramatically lowers throughput because they’re doing almost exactly

⏹️ ▶️ Chris Latner the same kinds of operations that ARC is doing. The problem that it then introduces,

⏹️ ▶️ Chris Latner though, is that these operations that the garbage collector’s introducing are sometimes, but not nearly

⏹️ ▶️ Chris Latner as well optimizable as the ARC overhead that the ARC optimizer applies to.

⏹️ ▶️ Chris Latner And furthermore, there’s no kind of out on it. So with ARC, I think and hope that the ownership model will

⏹️ ▶️ Chris Latner give people the ability to take control of those overheads. And if it becomes a problem in practice, or

⏹️ ▶️ Chris Latner if they’re just that kind of person, they can take full control over the lifetime of their objects and then know the ARC

⏹️ ▶️ Chris Latner will never happen. In the garbage collector, you don’t have that. So the performance side of things, I think,

⏹️ ▶️ Chris Latner is still up in the air because Arc certainly does introduce overhead.

⏹️ ▶️ Chris Latner Some of that’s unavoidable, at least without lots of annotations in

⏹️ ▶️ Chris Latner your code. But also I think that Arc is not done yet. A ton of energy has been

⏹️ ▶️ Chris Latner poured into research for garbage collection, particularly since Java has come up. There have been hundreds

⏹️ ▶️ Chris Latner of papers written in the academic circles, tons of work in Hotspot and

⏹️ ▶️ Chris Latner other Java implementations to do different tweaks and different tunings and different

⏹️ ▶️ Chris Latner new kinds of algorithms in garbage collection. And that work really hasn’t been done for Arc yet. And so

⏹️ ▶️ Chris Latner I think that there’s still a big future ahead. On the programming side of things, the cycle side

⏹️ ▶️ Chris Latner of things, I think it’s also a really interesting question of how much should people think about memory?

⏹️ ▶️ Chris Latner When I was baiting you a little bit, you said that the great thing about garbage collection is that you

⏹️ ▶️ Chris Latner don’t have to think about memory. But of course we know that’s not true, right? because if you have a

⏹️ ▶️ Chris Latner reference to some big object graph that you didn’t mean to keep around, maybe it’s in your undo stack, then you will

⏹️ ▶️ Chris Latner quote unquote leak that memory, right? And that’s true of a garbage

⏹️ ▶️ Chris Latner collector, that’s true of ARC as well. It’s just any automatic memory management approach has

⏹️ ▶️ Chris Latner that problem. And so that is a really

⏹️ ▶️ Chris Latner interesting thing that there’s this question of, if you’re building a

⏹️ ▶️ Chris Latner large scale system, Do you want people to quote unquote, never think about memory?

⏹️ ▶️ Chris Latner Do you want them to think about memory all the time like they did in Objective-C classic retain

⏹️ ▶️ Chris Latner and release, manual retain and release? Or do you want something in the middle? And I think the arc strikes a

⏹️ ▶️ Chris Latner really interesting balance, either whether it’s in Objective-C or in Swift, where

⏹️ ▶️ Chris Latner I look at manual retain and release as being a very imperative style of memory management

⏹️ ▶️ Chris Latner or Malcon-free, all these things where you’re telling the code line by line, this is where you should do

⏹️ ▶️ Chris Latner a reference count operation, this is where you should release the memory, this is what you should do at this point in time.

⏹️ ▶️ Chris Latner Arc then takes that model and bubbles it up a big step, and it makes it be a very

⏹️ ▶️ Chris Latner declarative model. So instead of telling the compiler that this is the place you

⏹️ ▶️ Chris Latner should do a retain, you instead say, this is an owning relationship. And

⏹️ ▶️ Chris Latner the cool thing about that to me is that not only does that get rid of the mechanics

⏹️ ▶️ Chris Latner of maintaining reference counting and define away tons of bugs by doing that, it also means that it

⏹️ ▶️ Chris Latner is now explicit in your code what your intention was. And that’s something that people who maintain your

⏹️ ▶️ Chris Latner code benefit from. And so by saying that I have a weak pointer to the parent object

⏹️ ▶️ Chris Latner of my thing, that’s a really important relationship to know about. And

⏹️ ▶️ Chris Latner as you’re looking at the code, you’re maintaining the code, having that be explicit is very valuable because that talks about

⏹️ ▶️ Chris Latner the relationship between values and to me, again, with the goal of

⏹️ ▶️ Chris Latner being able to write large scale applications in Swift, I think that’s really useful. I also don’t think it’s hugely burdensome,

⏹️ ▶️ Chris Latner though it is definitely part of the learning curve of learning how Swift works that, you

⏹️ ▶️ Chris Latner know, has to be balanced in there as well. And so,

⏹️ ▶️ Chris Latner, Casey I don’t know,

⏹️ ▶️ Chris Latner I mean, I look at it as there, Arc has clear advantages

⏹️ ▶️ Chris Latner in terms of allowing Swift to scale down to systems that can’t

⏹️ ▶️ Chris Latner tolerate having a garbage collector, for example, if you want to write firmware in Swift. I

⏹️ ▶️ Chris Latner think it does provide a better programming model where programmers think just a little bit about memory.

⏹️ ▶️ Chris Latner And I think that going forward, it provides a really high performance

⏹️ ▶️ Chris Latner model that you can get better than garbage collection in almost every way. So

⏹️ ▶️ Chris Latner I think that in terms of trade-offs, it’s the right one to push forward. The other, I guess, third piece

⏹️ ▶️ Chris Latner that garbage collection is really bad about is

⏹️ ▶️ Chris Latner kind of a showstopper for Swift, which is interoperability with C code. So if you’ve

⏹️ ▶️ Chris Latner ever worked with Java or with other similar garbage collected languages,

⏹️ ▶️ Chris Latner one of the major advantages the garbage collectors give you is that they move objects and they need to do that so they can compact

⏹️ ▶️ Chris Latner those objects so that they can then efficiently do allocations. But the

⏹️ ▶️ Chris Latner problem is that once you start moving objects around if you’re interfacing with C code, you can’t have some

⏹️ ▶️ Chris Latner random C code having a pointer to your object and have it move because then you get a dangling pointer.

⏹️ ▶️ Chris Latner And so once you get down that line, you end up with things like JNI, the Java Native

⏹️ ▶️ Chris Latner Interface, where you have to explicitly pin things, you have to maintain them, it’s

⏹️ ▶️ Chris Latner very complicated, it’s really buggy, and Arc completely defines this away by

⏹️ ▶️ Chris Latner just saying that, okay, something’s in memory, it has predictable lifetime, you can

⏹️ ▶️ Chris Latner reason about it, Swift provides tools for dealing with unsafe pointers and things like that,

⏹️ ▶️ Chris Latner and that makes the interoperability with existing C code, but also with Objective-C and maybe someday C++ code.

⏹️ ▶️ Chris Latner Really simple, really natural, and really efficient. And I think that’s a huge advantage that Arc provides

⏹️ ▶️ Chris Latner that really would be impossible to do with a garbage collector.

⏹️ ▶️ Chris Latner So that’s my opinion. I mean, I think reasonable

⏹️ ▶️ Chris Latner, Marco people

⏹️ ▶️ Chris Latner disagree, obviously, but it’s something that does come up now and then.

⏹️ ▶️ John Or it used to come up anyway. I’m convinced. I think you should use Arc for Swift. Get on that. Yep, there we go.

⏹️ ▶️ Casey Chris, thank you. Thank you very, very, very much for coming on the show. Obviously we are

⏹️ ▶️ Casey not an interview show as listeners have discovered over the last hour or two, but to

⏹️ ▶️ Casey take your time on what is presumably a very busy time of your life and spend it with

⏹️ ▶️ Casey us three knuckleheads, I really appreciate it. And it was very kind of you to do and hopefully

⏹️ ▶️ Casey this won’t be the last time that we’ll hear you on a show or maybe even this show. We’ll see. So thank you, Chris. I

⏹️ ▶️ Casey really appreciate it. Chris Steininger Yeah. Well, thank you

⏹️ ▶️ Chris Latner for having me. I’m terrified and probably made a fool out of myself.

⏹️ ▶️ Casey Not at all. Trust me, that’s normal. I’m still trying to get over that. Plus that’s our job.

⏹️ ▶️ Marco All right. All right. Thanks a lot to our three sponsors this week, Eero, Squarespace, and Audible. and we will see

⏹️ ▶️ Marco you next week.

Ending theme

⏹️ ▶️ Casey Now the show is over, they didn’t even mean to begin Cause

⏹️ ▶️ Casey it was accidental, oh it was accidental

⏹️ ▶️ Casey John didn’t do any research, Marco and Casey wouldn’t let him Cause

⏹️ ▶️ Casey it was accidental, oh it was accidental

⏹️ ▶️ Casey And you can find the show notes at atp.fm

⏹️ ▶️ Casey And if you’re

⏹️ ▶️ John into Twitter, you can follow them at C-A-S-E-Y-L-I-S-S

⏹️ ▶️ Casey So that’s Casey Liss, M-A-R-C-O-A-R-M, and

⏹️ ▶️ Casey T. Marco Armin S-I-R-A-C-U-S-A Syracuse

⏹️ ▶️ Casey It’s accidental, they didn’t

⏹️ ▶️ Casey mean to

⏹️ ▶️ John Accidental, check podcast so long

Post-show: Making splinters

⏹️ ▶️ John We didn’t talk about woodworking stuff.

⏹️ ▶️ Chris Latner Yeah, making splinters is fun.

⏹️ ▶️ John What kind of wood was that table made out of?

⏹️ ▶️ Chris Latner It’s walnut.

⏹️ ▶️ John That’s got to be tough. That’s a lot of cutting. That’s pretty hard wood, right?

⏹️ ▶️ Chris Latner Yeah, I mean it takes time, but it’s fun. It’s one of these areas where you can learn a lot

⏹️ ▶️ Chris Latner about it over time and keep going deeper and deeper in different spaces and you never

⏹️ ▶️ Chris Latner know everything. So it’s a lot of fun to dive into woodworking. also very very different than sitting

⏹️ ▶️ Chris Latner in front of a computer all day yeah you actually get to make something with your hands and you get a build much higher chance

⏹️ ▶️ Chris Latner for dismemberment

⏹️ ▶️ Marco that is true that is true so like I think it’s interesting when programmers have like incredibly

⏹️ ▶️ Marco analog hobbies

⏹️ ▶️ Chris Latner it’s also hilarious because the woodworking community is going through this whole CNC thing

⏹️ ▶️ Chris Latner, John turning

⏹️ ▶️ Chris Latner it into a very programmed thing and people always say well, why don’t you get into CNC and do blah,

⏹️ ▶️ Chris Latner blah, blah? But that’s exactly what I’m escaping. I don’t want to have to program my.

⏹️ ▶️ Marco I love that you can’t even escape the community arguments over standards.

⏹️ ▶️ John So you just cut down a tree and you throw it into your workshop and then out comes a table.

⏹️ ▶️ Chris Latner Yeah, well, so that’s the funny thing about people is that people are all the same. They just don’t want to notice

⏹️ ▶️ Chris Latner and agree to that. Oh my goodness. You get to very different communities and they think they’re all different, but they’re actually

⏹️ ▶️ Chris Latner the same at root.

Post-show: Neutral

⏹️ ▶️ Casey So Chris, you’re obviously changing careers, well not careers necessarily,

⏹️ ▶️ Casey but changing employers. Would you consider yourself a car person?

⏹️ ▶️ Chris Latner Chris Steiner Well, that’s a funny question. I mean, I obviously need a car.

⏹️ ▶️ Chris Latner Car is really important. But I’m what I consider to be an un-car person. I want

⏹️ ▶️ Chris Latner to accelerate the path to cars being appliances that solve people’s problems.

⏹️ ▶️ Chris Latner And I’m personally not the kind of guy who loves doing oil changes and fiddling around with

⏹️ ▶️ Chris Latner them. I just want something that is reliable, that works, ideally drives me to where I want to go,

⏹️ ▶️ Chris Latner and I don’t have to think about it. It’s just solving my problems. It’s not something I have to care

⏹️ ▶️ Chris Latner for, feed, and maintain. So that’s kind of the way I look at cars. Can you drive

⏹️ ▶️ Chris Latner a stick? I did drive a stick before I got my Tesla a few years ago.

⏹️ ▶️ Chris Latner So, yeah.

⏹️ ▶️ Casey It all comes clear now.

⏹️ ▶️ Marco I mean, really, from the point of view, it kind of sounds like you want to make cars is boring

⏹️ ▶️ Marco in a good way, really. And that’s a notable goal, and I can see why you went

⏹️ ▶️ Marco to Tesla. However, it is kind of funny that Tesla is, in my opinion, clearly the

⏹️ ▶️ Marco most exciting car company that the world has known for quite some time. And so to go there

⏹️ ▶️ Marco while having such an almost nonchalant opinion about cars is

⏹️ ▶️ Marco interesting to me.

⏹️ ▶️ Chris Latner Yeah, well, I admit that I never considered going to work at a car company before,

⏹️ ▶️ Chris Latner but that’s because I always considered car companies to be, you know,

⏹️ ▶️ Chris Latner not in need of the kinds of skills that I bring. But autopilot, I think, is a really exciting

⏹️ ▶️ Chris Latner and really big problem, and it kind of fits with my desire to solve

⏹️ ▶️ Chris Latner nearly impossible problems and take on new things. And so I’m really excited

⏹️ ▶️ Chris Latner about it.

⏹️ ▶️ Marco So I’m a little curious on that note. We’ve talked on the show before

⏹️ ▶️ Marco about whether we think that full self-driving cars,

⏹️ ▶️ Marco basically when and whether we think those will exist, like in what kind of time frame are we talking a decade, our lifetimes,

⏹️ ▶️ Marco ever? Because it’s one thing to make something that can work on clearly marked highways. It’s another

⏹️ ▶️ Marco thing that can make something work where John lives, where there’s ice all over the roads for most of the

⏹️ ▶️ Marco year. And so there’s no more lane markings, there’s barely any flat road surfaces, or

⏹️ ▶️ Marco you have all these different ambiguities that you have in real world roads.

⏹️ ▶️ Marco Do you think… Again, obviously, this is not in any kind of official capacity as an

⏹️ ▶️ Marco about-to-be Tesla employee. Do you think, big picture,

⏹️ ▶️ Marco that we will see completely self-driving cars capable of driving on effectively all roads

⏹️ ▶️ Marco within, say, the next decade? And if maybe within our lifetimes?

⏹️ ▶️ Chris Latner Yeah, I think that it’s very possible within the next decade. And hopefully that’s a long, long,

⏹️ ▶️ Chris Latner long view. But keep in mind, the goal is to drive

⏹️ ▶️ Chris Latner better than a human, and significantly better than a human. And I think one of the things

⏹️ ▶️ Chris Latner that gives me confidence in this is that it’s not an even playing field

⏹️ ▶️ Chris Latner because the autonomous cars have more sensors than humans do. You

⏹️ ▶️ Chris Latner know, they have a radar, for example. And that means that they’re capable of doing things that humans

⏹️ ▶️ Chris Latner just physically can’t. And there’s a huge technology problem, there’s huge software

⏹️ ▶️ Chris Latner problems. This is not a overnight kind of a thing that you wake up and solve immediately.

⏹️ ▶️ Chris Latner But I have confidence it could be solved, certainly within a decade.

⏹️ ▶️ Casey Well, the good news is it’s not gonna take a lot to be better than your average driver from Massachusetts,

⏹️ ▶️ Casey because that’s a pretty low bar.

⏹️ ▶️ John No, because they know how to navigate these

⏹️ ▶️ John, Casey intersections that have like seven

⏹️ ▶️ John different exits, all at different angles, some of which are one way, none of which are marked. So the humans

⏹️ ▶️ John can figure that

⏹️ ▶️ John, Marco out. It’s

⏹️ ▶️ John gonna be tough for the sensors.

⏹️ ▶️ Marco Tell you one thing, I will drive in Manhattan without any problems. I would never drive in Boston.

⏹️ ▶️ Casey Oh, amen, brother. I completely agree. All right, so to bring this back around, Chris, you made mention way early

⏹️ ▶️ Casey in the episode that you like yellow cars. What? Yeah, yeah.

⏹️ ▶️ Casey, Chris Latner What is this

⏹️ ▶️ Chris Latner some my my my one of my favorite cars was a yellow mini cooper with

⏹️ ▶️ Chris Latner black hood stripes on it nice and Many Cooper convertible it was totally awesome

⏹️ ▶️ Chris Latner that doesn’t get you in the carpool lane, but It was a beautiful car

⏹️ ▶️ Marco in his defense like yellow Like I’ve seen a like that kind of that kind of

⏹️ ▶️ Marco that category of color like yellow orange maybe teal or even like

⏹️ ▶️ Marco a pink, like they’re kind of like bright, almost neon-ish colors, can work really well. They

⏹️ ▶️ Marco often don’t, but when they work well, they look pretty good. I could totally see

⏹️ ▶️ Marco that. The only flaw I see in this plan is that Tesla does not currently offer either

⏹️ ▶️ Marco yellow paint as an option or custom paint colors as an option.

⏹️ ▶️ Chris Latner Well, so now you’ve broken into the real secret. They want to hire a compiler guy. That’s why.

⏹️ ▶️ John Would you’ve gotten your Tesla in yellow if you could have?

⏹️ ▶️ John, Chris Latner Yes, absolutely. It would look like a giant

⏹️ ▶️ John, Marco banana. What

⏹️ ▶️ John, Casey are you talking about? Yeah, I hadn’t really fully

⏹️ ▶️ Casey thought this through, John. I don’t know if that car can pull it. We’re talking about a Model S,

⏹️ ▶️ Chris Latner right?

⏹️ ▶️ Chris Latner, John Yeah. Yeah.

⏹️ ▶️ Chris Latner No, I would. Yellow doesn’t seem right

⏹️ ▶️ John for that. We could do some Photoshop mockups. Let’s workshop it a little bit. We’ll see. Maybe if you’ve got black stripes down the middle. Yeah, I

⏹️ ▶️ John admit this is a case where details matter. So, yeah, I would. I would. I would. I would.

⏹️ ▶️ John, Casey I would. I would. I

⏹️ ▶️ John would. I would. I would. I would. I would.

⏹️ ▶️ Chris Latner or so yeah no I mean

⏹️ ▶️ Marco that’s like if there’s any if there’s any way for you to get like a pet feature implemented in the model line

⏹️ ▶️ Marco that seems like a pretty good one to do at least and you know I would ask I’m

⏹️ ▶️ Marco sure I know you’re probably not gonna be working on the Bluetooth UI but I’m sure you could probably

⏹️ ▶️ Marco put in a word with the right people to please improve Bluetooth audio

⏹️ ▶️ Marco but otherwise if you can make a yellow one I think that would be you know in addition to potentially

⏹️ ▶️ Marco saving thousands of lives a year with autopilot software, getting improved Bluetooth and

⏹️ ▶️ Marco a yellow option would be pretty impressive.

⏹️ ▶️ John Well, yellow would make your car more visible to other drivers, other human drivers, who need bright colors to know

⏹️ ▶️ John that you’re there since you don’t have any engine sound.

⏹️ ▶️ Chris Latner And I have to say, this is the most effort I’ve ever done to win over one Swift programmer. So

⏹️ ▶️ Chris Latner I’m not sure if this is a scalable approach.

⏹️ ▶️ Chris Latner Yeah,

⏹️ ▶️ Chris Latner, John that’s a bad strategy for swift adoption. You should

⏹️ ▶️ John seek other means instead of coming on everybody’s podcast and talking to them individually. Oh my God, that’s amazing.