A Type System From Scratch
summary
A compact, concrete tour of how Swift’s type system is reduced to a tiny core, turned into constraints, and solved as a graph: builds a constraint graph from expressions (you can reproduce this with Swift’s -Xfrontend -debug-constraints), demonstrates solving by connected components, and shows defaults and overloads in action (e.g. ~60 slash overloads). Claims inference complexity rises rapidly with features (PSPACE-hard, NP-hard via a 3‑SAT overload encoding, exponential with polymorphism), notes the real checker needs 30–60 rules, and links an implementation using Algorithm W and M plus a constraint generator.
AI-written summary · about
