Skip to content
0:00 / 0:00

#foundationdb#swift-c-interop#memory-safety

"Swift as C++ Successor in FoundationDB" by Konrad Malawski (Strange Loop 2023)

Strange Loop Conference

88K subscribers • 107 videos on Hallway • Conference channel

YouTube
  • Recommended by 3 people: 3 on Hacker News.
  • Presented by Konrad Malawski

Intermediate. Assumes working knowledge.

19K views3 years ago3 recommendations

Programming languagesDatabases and dataSwiftC++Database internals

Konrad Malawski explains how the FoundationDB team incrementally adopted Swift into their C++ codebase using Swift's C++ interoperability features.

Programming languages often prioritize either performance or ergonomics. Swift offers a unique modern type-safe low-ceremony approach taking the best of both worlds that scales from mobile apps to high-performance systems where previously memory-unsafe languages would be used. It also interoperates seamlessly with C and C++. In this talk, we show how we successfully adopted Swift in FoundationDB, a distributed database struggling to modernize its C++ codebase. Swift's interoperability features allowed the team to incrementally move single functions, or entire types, to Swift. This transition was done without generating any bindings and while preserving the existing semantics. FoundationDB uses a custom actor runtime, which enables reproducible simulation testing. Again, Swift's flexible concurrency and distributed actor model enabled an incremental side-by-side approach by having Swift concurrency seamlessly execute on the existing scheduling infrastructure. Konrad Malawski Swift Team, Apple @ktosopl Konrad works in the Swift team at Apple, where he focuses on foundational server-side Swift libraries and concurrency features of the language. He was part of the design and implementation of Swift’s structured concurrency and actor model, as well as the distributed actors language feature and cluster library. He also maintains server-side observability libraries for logging, metrics and distributed tracing. Previously, he worked on Akka at Lightbend/Typesafe, where he maintained core pieces of the ecosystem, including the clustering, event sourcing, streaming and HTTP libraries. He also made significant contributions to the reactive-streams specification and TCK which later became the foundation of the JDK’s java.util.concurrent.Flow types. ---- Recorded Sept 21, 2023 at Strange Loop 2023 in St. Louis, MO. thestrangeloop.com

Why it's here

3 people recommend this

What people say. Recommended for its detailed look at Swift's C++ interoperability and its practical application in a large systems codebase.

mannuchon Hacker News • Recommends

On “Memory safety is necessary, not sufficient”

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 link Konrad Malawski at StrangeLoop 2023 link to this video

glhayneson Hacker News • Recommends

On “Swift Static Linux SDK”

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) link - "Swift as C++ Successor in FoundationDB" (Konrad Malawski; Strange Loop 2023) link to this video And then a series of blog posts by Doug Gregor: - "Swift for C++ Practitioners" link And finally: - "Mixing Swift and C++" (Swift.org) link

cube2222on Hacker News • Recommends

On “Ladybird browser to start using Swift language this fall”

…e interesting to see too, and would inspire confidence if the process is going well. Arc is also a nice example of a cross-platform app written in Swift, with their fairly recent addition of Windows support. Either way, fingers crossed, and very happy with TFA. PS: does anybody have experience with async/await in Swift? Is it pleasant to use? 0: link to this video…

pjmlpon Hacker News • Mentions

On “Apple's use of Swift and SwiftUI in iOS 17”

On the same subject, some talks from Apple folks, "Introducing a Memory-Safe Successor Language in Large C++ Code Bases" link "Swift as C++ Successor in FoundationDB" link to this video

sandyarmstrongon Hacker News • Mentions

On “9 years of Apple text editor solo dev”

Yup, exactly. Swift was specifically designed to replace Objective-C and C++ throughout Apple codebases (see link to this video ). C# is a totally different story.

frankjron Hacker News • Mentions

On “Apple hiring compiler developers for improving Swift / C++ interoperability”

A lot of details on the interoperability also in the recent talk "Swift as C++ Successor in FoundationDB" at Strange Loop 2023. link to this video

Someoneon Hacker News • Mentions

On “Swift 6”

> I’d be interested to know how good this integration is in practice I haven’t used it, but from looking at the long) video at link to this video (discussed in link ), it looks pretty good.

pjmlpon Hacker News • Mentions

On “Apple’s Darwin OS and XNU Kernel Deep Dive”

…ort, 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 link to link "Swift as C++ Successor in FoundationDB" link to this video…

pjmlpon Hacker News • Mentions

On “FoundationDB: From idea to Apple acquisition [video]”

Nowadays being rewritten into Swift. "Swift as C++ Successor in FoundationDB" by Konrad Malawski (Strange Loop 2023) link to this video