On this weeks edition of The Talk Show, none other than Craig Federighi gives John Gruber an interview talking about Swift going open source and the future of the programming language.

Sorry about the lack of punctuation, it’s still being edited.

Gruber: It does different ways from the company especially becoming to do a quote and quote open source project are sort of like yes attacking with open source but it really just order a zip file with a open source license and there goes you have at it and then there’s the actively engaging in a community manner wears the outer world and though getting out of the BBC’s with the be up and source I think there are some sceptics who that maybe it was going to be a well technically it’s open source and there is but this is really like full throttle falling gates with the the world outside Cupertino.

Craig Federighi: Yeah I mean it’s funny I guess there there always will be skeptics but anyone who’s been watching our team in the context of like the LLVM world, clang, LLBB and in our WebKit team would see how how much developing in the open is in the spirit of those teams and so the Swift team has been among the most engaged with our developer community of any group and Apple even even prior to open sourcing in terms of from the first launch of announcements of Swift 1.0 on the App Store at the WWDC and how much they were engaging with all the feedback that was coming in and modifying the language right up to 2.0 and beyond and this is really an extension of how the only way they really have ever wanted to work.

They they are of very excited to be working completely in the open and it really is a case where as in all the features in Swift that will be announcing officially to the world at our next developer conference you can so see them unfold before your eyes in the time leading up to that is there working on the open on and get hub

Gruber: Just like everything else Apple does

Craig Federighi: Very Very similar to everything else we do

Gruber: The thing that to me is most telling and I know that GitHub makes it easy to track all these changes and see how many people for the but to me if you just want a quick look at just how much this is a a collaboration between the Swift team at Apple and the outside world it is the swift evolution mailing list. Where you know you guys have been upfront about this right from Swift 1.0  in 2014 that this is not a finished language we didn’t you that you didn’t go and finish language and here it is, have it, it’s we are still working on this a lot of what  will be working on is tell us what you  what you need and you’re on the mailing list there are people actively engaging and end employees from Apple Chris Lattiner and people on his team are fully engaging with these ideas and proposals that are coming from outside the company already one-week in one week into it being an open source project.

Craig Federighi: Oh yeah I think our team is is a really seasoned team in the world of of developing languages in and we know that a language really can’t be developed in a vacuum it’s it is a product of how people use it in the problems that people are trying to solve and so we knew from the outset was swift 1.0 that we could come up with the language that the first step you have to crystallize your basic ideas and have a starting point but we knew we needed feedback than to work toward the language that that ultimately Swift has and has become and will become the future but that we we needed to have this kind of open open dialogue and open sourcing is as you say just really accelerating in and deepening the kind of feedback that that were getting in so it’s it’s really energizing for us I think it’s really exciting for a lot of the developers in our community as well be a part of it.

Gruber: What are the other reasons to go open source with a new programming language?

Craig Federighi:  When we talked about as briefly WWDC I think we laid out the big ones which are at for us are swift is we think the primer programming language that developers should be taught to program in actually and if you learn computer science Swift is a fantastic learning language and if you’re a developer who is going to invest huge part of your career are in in mastering Swift and developing cadence with

the ability to use that code in every context possible and use your skill language in all environments in which you have to work to do your job so whether you’re scripting your build system or writing web services or of course writing your mobile applications we want to make sure you can invest in Swift int that way and know that it’s gonna be available to you everywhere. So and we saw open sourcing as a a critical element will make swift reaches potential to be to be the language the major language for  the next 20 years of programming and industry.

Gruber: Its a really ambitious goal.

Craig Federighi: It’s a really ambitious goal it is it is but I I think you know it at every point along the way is this this is been our vision from before we first unleashed Swift on the world but every step actually the reaction has a really outdone our expectations so maybe your goal is and so outlandish

Gruber: I would say that that for education purposes really has to be open source because there’s really no way that a language is going to take take root as a teaching language if it is proprietary to Apple platform or any other vendor’s platform.

Craig Federighi: Right you know we had a lot of universities who would teach a specialized mobile programming course or an iOS programming course and in the context of course on they teach Swift and and Stanford has an outstanding course it’s on iTunes U about programming in Swift to the program on iOS but when it comes to bringing it in the core curriculum that every student in the city University is to take let’s say learn computer science making it open source having it available to every student on whatever platform they’re going use to do their work is is we we think ultimately a huge enabler and so many of the people we talked to her. The professors wanted to use the language in these ways but they needed it to be open source for this to happen and so were really excited to follow through with them on this.

Gruber: Why not open source it? What were the downsides that were debated before you made the decision to open source with it?

Craig Federighi:

Gruber: One of the areas that I I would I think it stuff I see so much excitement about that already is in terms of being cross-platform is the use of swift answer was yes and a lot of that is certainly gonna be Lennox and you guys are already done the Portillo next arm and innards that is an area where I feel like we I I have no idea a I feel like it’s going to be as but I just it is outwitted solely we don’t know where that’s going to be but do you do you see that happening that is gonna be useful of server-based development that is really outside Apple’s platforms

Craig Federighi: There really weren’t that we are we of course talked it over it at length with a tough time coming up with a significant reason not to do it it was more when question you know is is it now and we knew after 1.0 that that we weren’t quite there, that we wanted to get that first round of feedback begin to stabilize the definition of the language but as we got close to WWDC this last year we realized we were where we needed to be on to take a step that we knew was was gonna happen it was gonna be this year was gonna be that the following year and and we realize we were where we needed to be and so we we moved ahead and not the hunger out there are was was so great we thought let’s let’s do it now but the downsides are are really limited I mean I think it’s it’s inevitable but positive that Swift will be used in all kinds of contacts outside of Apple that’s that’s kind of the point so that’s fine it’s clear were to get a lot of people wanting to do things with the language that aren’t directly related to Apple’s line of business and that’s okay right that’s that’s actually fine as well so they’re just there were a lot of downsides and and we think the upsides are tremendous.

Gruber: One of the areas that I see so much excitement about that already is in terms of being cross-platform is the use of swift on servers and a lot of that is certainly gonna be Linux and you guys are already done the port to Linux. That is an area where I feel it’s going to be as but I just it is outwitted solely we don’t know where that’s going to be but do you do you see that happening that is gonna be useful of server-based development that is really outside Apple’s platforms?

Craig Federighi: Oh totally yeah I mean you know it from really the outset IBM for instance jumped all over Swift for building their mobile apps and almost immediately they were coming back to us with we really want to use this on the server how can we can we get this on the server and of course with an Apple is tremendous passion for swift and our own iCloud team has been you know completely chomping at the bit to be able to apply it in in many many of the things they do so I think it’s it’s can be the first among the first breakout uses of Swift and of course these days so many mobile applications are part mobile app part server code and a lot of cases you you at the very least want to share your your knowledge but very often you want to share arts your code parts your model layer some your utility libraries you want us and and having no swift enabling you to do that is going to be huge for a lot of our community.

Gruber: I can definitely see that. That to to me is sort of the building for the future version aspects of Sift versus say Objective-C which has roots from 20 or even 30 years ago. The fact that the cloud or whatever you want to call your it.
clients software running on advice talking to servers somewhere off in the Internet is part of I would say that all almost certainly the overwhelming majority of apps that are being written for for these platforms that having a language that makes sense on both ends of the communication is huge.

Craig Federighi: Well exactly exactly and you know if you if you look at where I think it is for a lot of developers prior to Swift they probably were using Objective-C if they had high-performance code they had to write part of Objective-C is C and so they were dropping down into C to do some of the more optimized work which can be almost another language is a real continuum there within the environment they might’ve been using a scripting language for part of what they do and then he might be using a server-side language like Java and Swift is uniquely capable of spanning from really easy and natural scripting expressive uses it’s a great application programming language but was also designed be a great systems language and be really fast so that you can do see kind of high-performance work without compromises and swift and then it’s can work in in the cloud as well so I think it’s going to really unify the environment for a lot of developers

Gruber:How would you describe the systems language? This is right from the on my notes from the Swift programming language are it says, Swift is intended to be quote;

The first industrial quality systems programming language that is as expressive and enjoyable as a scripting language designed to scale from hello world to an entire operating system.

what is a systems programming language?

Craig Federighi:
Well there there is there some some low-level bits and and some some matters of the spirit I think and in terms of low-level bed Swift has a very predictable memory management model a very very contained run time if you look at traditional scripting languages or languages like Java on there they run garbage collectors you really can’t control memory and Aniston wastes Swift builds on our arc technology that that first came Objective-C to provide really high-performance and really predictable and manageable memory management.

Which means that if you wanted to write every thing from an operating system kernel to be a high-performance graphics library you could do that without inheriting a huge per process memory footprint overhead and you see that when you see how Apples OS and apps are able to run in a lower memory footprint and were able to ship a devices with different memory footprints then then some are competitors who use languages that don’t have this characteristic but Swift is also designed so that when it can be fast it’s as fast as can be so easy we are taking the overhead of dynamic dispatch for every call but yet we can provide dynamism when when needed, we can optimize you use an array in in Swift we can be every bit is optimal and do auto vector conversion and parallelization in ways that you would expect from off to my C code but are very hard to do if you are trying to optimize Ruby or Python or even in Objective-C and ONS array built on top of the foundation classes and so you can go very very low level and get very predictable peak performance out of your hardware.

Gruber:So in the words it at least, lets compare to Objective-C that objective C there are so many great things we can stay about it, its served Apple so incredibly well it still will for the foreseeable future in so many ways but there’s this big but which is that sometimes you need to say drop down into C or C++ NL now you are losing all of the stuff that you love about Objective-C because you need to drop down temporarily for performance reasons and Swift don’t need to do that. You can write a high-performance code right in Swift right within Swift.

Craig Federighi: That’s right I mean Swift who I think one of only first introduced Swift we we we said we are imagining a world where we took we loved about Objective-C without caring for the baggage of C but what that meant is Swift has to replace see in its role in Objective-C programming and it does that really well while bringing all of these higher levels of abstraction and higher productivity programming techniques to writing that kind of high-performance systems code but also so great for app code.

Gruber:One thing that is not Swift and I think we pretty much covered this but it is not Objective-C with prettier, better syntax. It is the syntax of Objective-C that people find offputting at least at first and I know that you know thats a debate that the people who love Objective-C and have used it for decades, it’s a never-ending argument but at least first even if you really really love Objective-C I feel like you can’t avoid the fact that at first it looks weird at first.

Craig Federighi: I’ll admit I’m an Objective-C love. There were plenty of good debates internally about you know should we have a Smalltalk inspired syntax, should we stick with something like Objective-C. In the end it can go either way and what we were able to retain in Swift are of the these sort of literate nature of APIs that Objective-C enabled, the readability of code with the labeled arguments. We brought all of that to Swift on while the same time having a syntax that is just much more concise and at this point with the sort of evolution of people’s expectations around programming languages its just much more natural for them.

Gruber:I can is is part of the thinking there at the in terms of the the Smalltalk inspired dynamic runtime that you didn’t need a new language is that because you are to have Objective-C and that you can go it you know that for the future for the next 20 years the dad sort of that sort model of looking at frameworks and programming languages isn’t the best way to go from here going forward?

Craig Federighi: No I would I would really separate I know it’s a I would separate that the syntax from some of the underlying aspects of the runtime and the programming model Swift you know some of my favorite features from Objective-C are things like protocols categories which would and Swift are called extensions and those literate APIs as well as first-class classes with with class method to all of these things that are so important for us to build great APIs and great extensible frameworks were were brought to Swift along with things like labeled arguments and slowly we’ve also been bringing back much of the dynamism now to some things that are possible in Objective-C and most the dynamism that you really want is the ability to figure out what class is this really need to be able to cast the class dynamically to a particular protocol to be able to do a kind of response to selector perform selector check all these things are possible and swift today and there’s some other things that are but that I’m certainly we consider important to ultimately bring bring to the language so this thing about a dynamic programming model is is still very important to us now to some very unsafe things that people do in Objective-C and I’ve I’ve been opened guilty of this myself we walked the object if you run time and hack the method table and in a school but it is it is highly unsafe and doesn’t lead to very maintainable scalable large program some of those techniques but the vast vast majority what makes Objective-C great and dynamic is is part of either part of Swift now or certainly part of our ongoing ambition for the language but the thing we didn’t want to bring from Objective-C is that in Objective-C you’re paying the overhead of that dynamism all the time I ate you know you’re trying to use an array or some some class and you’ve got the compiler with both hands tied behind his back in terms of opportunities for optimization in your forcing the developer to then modify the way they’ve written their code to maybe drop down to see for something where performance matters for Swift because it’s safer has more type information it gives the compiler what it needs to optimize when it can but that that alone doesn’t stand in the way of all the in my opinion all the dynamism the matters.


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.