3 ms·
TLDR: they're porting it from C++ to Swift for the safety, ergonomics, and multi-threading guarantees. Cool parts are that they compile C++ and Swift to LLVM b
by cube2222 3y ago
TLDR: they're porting it from C++ to Swift for the safety, ergonomics, and multi-threading guarantees.
Cool parts are that they compile C++ and Swift to LLVM bytecode, and then compile all of this together, so they get inlining and whatnot. In practice this means they can have C++ and Swift files side-by-side.
They add some special C++ attributes so that Swift understands how to refcount the given type (or maybe not refcount at all).
They also use Swift protocols and extension methods to improve the ergonomics of using C++ types in Swift.
Ergonomics were especially emphasized, so that people writing on FDB write new parts in Swift because they want to, not because they have to.