Introducing a Memory-Safe Successor Language in Large C++ Code Bases - John McCall - CppNow 2023
CppNow3 HN recommenders · recommended in 3 months, 2023–2025
talk · advanced · 2023–2025 on HN
John McCall of Apple's Swift team presents at CppNow 2023 on introducing a memory-safe successor language into large C++ code bases. He argues incremental improvement of C++ hits hard limits and explains Swift's C++ interoperability for gradual migration.
Used as the primary source for Apple's stated plan to make Swift its successor to C++ and for how interop supports gradual transition.
Up next
3 mo on HN"Swift as C++ Successor in FoundationDB" by Konrad Malawski (Strange Loop 2023)
Strange Loop Conference
3 HN recommender · 2023–2025
6 mo on HNCppCon 2017: Carl Cook “When a Microsecond Is an Eternity: High Performance Trading Systems in C++”
CppCon
5 HN recommender · 2017–2025
2 mo on HNCppCon 2014: Herb Sutter "Back to the Basics! Essentials of Modern C++ Style"
CppCon
2 HN recommender · 2014–2021
7 mo on HNCppCon 2015: Kate Gregory “Stop Teaching C"
CppCon
7 HN recommender · 2016–2025
4 mo on HNEdwin Brady - Idris 2 - Type-driven Development of Idris
Curry On!
4 HN recommender · 2019–2023
5 mo on HNEric Bier Demonstrates Cedar
Computer History Museum
3 HN recommender · 2020–2025
4 mo on HNCppCon 2016: Herb Sutter “Leak-Freedom in C++... By Default.”
CppCon
2 HN recommender · 2016–2025
3 mo on HNCppCon 2016: Dan Saks “extern c: Talking to C Programmers about C++”
CppCon
2 HN recommender · 2017–2025
11 mo on HNCppCon 2015: Andrei Alexandrescu “std::allocator...”
CppCon
7 HN recommender · 2017–2025
12 mo on HNLexical Scanning in Go - Rob Pike
GoogleFOSSSydney
13 HN recommender · 2012–2025
10 mo on HNCppCon 2017: Matt Kulukundis “Designing a Fast, Efficient, Cache-friendly Hash Table, Step by Step”
CppCon
9 HN recommender · 2018–2026
9 mo on HNRustConf 2018 - Closing Keynote - Using Rust For Game Development by Catherine West
Rust Programming Language
9 HN recommender · 2018–2023
12 comments from Hacker News
I'm not a (direct) user of the C++ interop, but everything I've heard about it has been quite positive. A few hopefully relevant resources, first a couple of videos: - "Introducing a Memory-Safe Successor Language in Large C++ Code Bases" (John McCall; CppNow 2023) ▶ this video - "Swift as C++ Successor in FoundationDB" (Konrad Malawski; Strange Loop 2023) link And then a series of blog posts by Doug Gregor: - "Swift for C++ Practitioners" link And finally: - "Mixing Swift and C++" (Swift.org) link
I wonder what the author thinks about Swift’s new C++ interop story? Since the Swift compiler includes Clang, and can thus compile both your C++ and Swift into LLVM IR, without the need for an FFI later between the two, couldn’t this be the “Typescript for C++” that the author points out a space for? The Swift folks are very much thinking about Swift as a C++ successor that can be incrementally migrated to so I’m a bit surprised the author didn’t discuss it further — especially given Swift’s spiritual similarities to Rust. There’s a couple great talks on this by folks on the Swift team. John McCall at CppNow ▶ this video Konrad Malawski at StrangeLoop 2023 link
Java also compiles to native code on Android. Try to write an iOS application using only C and C++, instead of either Objective-C or Swift. "Swift was designed from the outset to be safer than C-based languages, and eliminates entire classes of unsafe code" -- link "Swift is a successor to the C, C++, and Objective-C languages. It includes low-level primitives such as types, flow control, and operators. It also provides object-oriented features such as classes, protocols, and generics, giving Cocoa and Cocoa Touch developers the performance and power they demand." -- link Some of the information related their Safe C dialect, link "2023 EuroLLVM - Keynote: “-fbounds-safety”: Enforcing bounds safety for production C code" link Finaly a recent gem from CppNow 2023, "Introducing a Memory-Safe Successor Language in Large C++ Code Bases" ▶ this video
On the same note, watch Apple's talk at CppCon 2023, "Introducing a Memory-Safe Successor Language in Large C++ Code Bases" ▶ this video
Yes, Apple themselves, apparently folks wanting Apple to use Rust don't read Apple's documentation or watch talks done by Apple compiler developers. > Swift was designed from the outset to be safer than C-based languages, and eliminates entire classes of unsafe code. -- link > Swift is a successor to the C, C++, and Objective-C languages. It includes low-level primitives such as types, flow control, and operators. It also provides object-oriented features such as classes, protocols, and generics. -- link "Introducing a Memory-Safe Successor Language in Large C++ Code Bases" ▶ this video "So we feel pretty strongly, obviously at Apple our sucessor language is Swift and I am here to talk about features of Swift, both to try to sell you on to it, but also to talk about the things we think are pretty necessary and the ways in which a programming language can support, you know, clear code, safer and more correct code." "Like I said before, Apple has always intended for Swift to be a sucessor language for all of our predecessors, from the top to the bottom of our stack, accessible to novices, powerful enough for experts, it is real a tall order. From ▶ this video to ▶ this video "Swift as C++ Successor in FoundationDB" link
Apple wants to migrate away from C++, including code in the kernel, so they need a safe, low-overhead language. Swift has originally been designed as an ObjC replacement, mostly for UI glue code, with conveniences more like a scripting language. So now they're working on making Swift support more low-level low-overhead code. ▶ this video
John McCall (Swift team) gave a talk on Swift replacing C++ earlier this year: ▶ this video Selfishly I wish mixed C targets were a priority before C++ but I get why this was more important to them
I wonder if they are thinking Swift - their C++ interop is still pretty new and has a way to mature, but it’s designed for exactly this [1] (we should expect Apple to start doing it with WebKit and other big C++ projects, even perhaps LLVM). 1. ▶ this video
They definitely have opened some things up, like a full C++ interface to Metal. I think the idea with this current effort is kind of the opposite though - not to encourage more use of C++, but to start writing new features of C++ projects in Swift (the presenter at the C++ Now 2023 talk [1] goes into this). I expect WebKit is a big target for them, I think they eventually want to replace all their C++ with Swift gradually (instead of trying to do ground-up rewrites, where you dedicate a team to doing that for years and you have a replacement at the end with fewer features than the old project). 1. ▶ this video
Apple's John McCall makes a picture of where they are going with Swift in "Introducing a Memory-Safe Successor Language in Large C++ Code Bases" ▶ this video
Apple's John McCall makes a picture of where they are going with Swift in "Introducing a Memory-Safe Successor Language in Large C++ Code Bases" ▶ this video
There are zero references to Rust on that talk. It is all about C, C++, Objective-C and how Apple is replacing them with Swift. Rust isn't even shown on languages in use at Apple, ▶ this video As for tracking down the exact minutes of each Swift reference, maybe I will try to find some time on my side to prove me right on the Internet.