u/dharmatechin r/swift • Recommends
2017 LLVM Developers’ Meeting: “Implementing Swift Generics ”
18K subscribers • 15 videos on Hallway
- Recommended by 4 people: 2 on Hacker News, 1 in engineering communities and 1 curated list.
- A classic. People kept recommending it from 2017 to 2022.
- Presented by Douglas Gregor, Slava Pestov, and John McCall
Advanced. Deep dive for people who know the field.
20K views9 years ago4 recommendations
Programming languagesSystems programmingSwiftCompilers and interpretersLanguage design and type systems
Douglas Gregor, Slava Pestov, and John McCall explain how the Swift compiler implements generics using a dictionary-passing approach with reified metadata.
LLVM.org/devmtg/2017-10/ — Implementing Swift Generics - Douglas Gregor, Slava Pestov and John McCall Slides: Coming Soon — Swift is a safe and efficient systems language with support for generic programming via its static type system. Various existing implementations of generic programming use either a uniform runtime representation for values (e.g., Java generics) or compile-time monomorphization (e.g., C++, Rust). Swift takes a “dictionary-passing” approach, similar to type-classes in Haskell, using reified type metadata to allow generic code to abstract over the memory layout of data types and avoid boxing. In this talk, we will describe the compilation of Swift’s generics from the type checker down to LLVM IR lowering and interaction with the Swift runtime, illustrating the how the core representation of generics flows through the system, from answering type-checking queries to the calling convention of generic functions and runtime representation of the “dictionaries”. — Videos Filmed & Edited by Bash Films: BashFilms.comWhy it's here
4 people recommend thisWhat people say. Recommended for its deep dive into how Swift's generics implementation differs from C++, Rust, and Java to support ABI stability.
programming-talkscurated list on GitHubRecommends
Under “Swift”
Veedracon Hacker News • Recommends
On “Type Erasure in Swift”
favoritedon Hacker News • Recommends
On “Compiling Swift Generics [pdf]”
u/jdh30in r/ProgrammingLanguages • Mentions
On “Unboxed Types for OCaml”
u/theindigamerin r/ProgrammingLanguages • Mentions
On “Monomorphization vs. Boxing”
u/lngnsin r/ProgrammingLanguages • Mentions
On “What languages have protocols like Swift?”
u/bjzabaPikelet, Unnamed Binary DDLin r/ProgrammingLanguages • Mentions
On “Implementing Generics via Passing Type Information at Runtime?”
favoritedon Hacker News • Mentions
On “Swift Project in 2023”
mananaysiempreon Hacker News • Mentions
On “A tail-call interpreter in (nightly) Rust”
u/Dense-Buttonin r/ProgrammingLanguages • Mentions
On “Higher-order Zero-cost Abstractions”
u/1vaderin r/ProgrammingLanguages • Mentions
On “Compiling language with generics to C”
u/Lantuain r/ProgrammingLanguages • Mentions
On “Generic Functions Implementation for my Language”