HN Theater @HNTheaterMonth

The best talks and videos of Hacker News.

Hacker News Comments on
2017 LLVM Developers’ Meeting: “Implementing Swift Generics ”

LLVM · Youtube · 5 HN points · 3 HN comments
HN Theater has aggregated all Hacker News stories and comments that mention LLVM's video "2017 LLVM Developers’ Meeting: “Implementing Swift Generics ”".
Youtube Summary
http://www.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: http://www.BashFilms.com
HN Theater Rankings

Hacker News Stories and Comments

All the comments and stories posted to Hacker News that reference this video.
Nov 18, 2022 · favorited on Swift Project in 2023
The Swift story around ABI stability and library evolution is pretty unique. Relatedly, its approach to generics doesn't fall into either of the 2 traditional paths (either box everything like Java and C#, or template instantiation like C++ or Rust).

https://faultlore.com/blah/swift-abi/

https://www.youtube.com/watch?v=ctS8FzqcRug

cwzwarich
The closest thing to Swift’s approach to polymorphism in the academic world is intensional polymorphism:

https://www.cs.cmu.edu/~rwh/papers/intensional/popl95.pdf

Swift's generics have some unique properties at module boundaries to allow for a stable ABI while enabling library evolution.

To get additional background, you might be interested in this[0] conference talk (the paper's author is one of the co-presenters). Also, this post[1] by a Rust and Swift compiler engineer talks about what Swift does differently than other languages, and the tradeoffs that are involved.

[0]https://www.youtube.com/watch?v=ctS8FzqcRug

[1]https://faultlore.com/blah/swift-abi/

Jun 16, 2020 · 2 points, 0 comments · submitted by TheAsprngHacker
Dec 15, 2017 · Veedrac on Type Erasure in Swift
If you're interested, there's a very nice talk on how Swift's generics compile. It's different to Rust in some key ways.

https://www.youtube.com/watch?v=ctS8FzqcRug

mikeash
Thanks for posting this, I've been meaning to watch it but keep forgetting about it.
Nov 20, 2017 · 1 points, 0 comments · submitted by bakery2k
Nov 06, 2017 · 1 points, 0 comments · submitted by willvarfar
Nov 01, 2017 · 1 points, 0 comments · submitted by stablemap
HN Theater is an independent project and is not operated by Y Combinator or any of the video hosting platforms linked to on this site.
~ yaj@
;laksdfhjdhksalkfj more things
yahnd.com ~ Privacy Policy ~
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.