"Swift as C++ Successor in FoundationDB" by Konrad Malawski (Strange Loop 2023)
Вставка
- Опубліковано 5 жов 2024
- 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...
Great presentation, thank you!
glad that swift successors keep coming, despite some initial setbacks! 🦆+ 1
Rust language founder also worked on swift
Wow really great talk! I’m coming from a JS/TS background and this was really helpful in understanding some things about both C++ (a language I’ve only a cursory understanding of) and Swift (same level), and just systems programming language concepts in general.
The backtrace support is very impressive
I love that talk.
i never had any contact with swift - mostly because it was "apple app language" in my mind.
interesting. Maybe i have to give it a try.
but i also kinda feel like Konrad may take over the world until then :D
I recommend learning Swift, at least play with it and get to know some of the language concepts and decisions in Swift. It’s pretty neat IMHO, from things like progressive discourse and safety by default to having clear and easy distinction between reference and value types and semantics, abstract generic algorithms and protocol oriented programming. Swift and Rust have many things in common, e.g safety by default, but some key decisions in the Swift Language make it so much more expensive while reducing complexity compared to Rust, e.g an easy foot gun is accidentally creating leaky abstractions. It’s worth to mention my bias, my nerdy heart finds it rather beautiful language ❤ just take a look at the standard library, e.g protocols like Sequence and Numeric
Predecessor language is C or C++? Are they forbidden to mention Objective-C?
we don't speak of objective-c
Are they using Swift in the Kernel?
Nice presentation. But the code Syntax could have been larger.
22:55 I like the rust lingo better - impl Trait for Struct
“[swift] is equally supported on other platforms” that is not entirely accurate.
Can you elaborate? Just how worse is developing in Swift on Linux? What about successfully cross compiling Sift software on Windows, Linux, Android?
It has the same release train for all platforms and they all receive all the patches. There are some differences between platforms but it’s not a big deal imo
12:58 "lets talk little bit about language model" - flashbacks
C++ interop seems simpler than C (which i think requires an ObjC bridge?)